• Register

Recent questions tagged input

0 votes
1 answer 3 views
Problem: If I want to take a number as input, would I also need the .strip() method? Like this: n = int(input().strip()) Instead of just coding: n = int(input()) I know .strip() returns a copy of the string in which all chars have been stripped from the beginning and the end of the string. But I wonder why / if it is necessary.
asked 3 days ago Mashhoodch 6.6k points
0 votes
1 answer 5 views
Problem: I have a text file with on every line one or more integers, seperated by a space. How can I in an elegant way read this with C++? If I would not care about the lines I could use cin >>, but it matters on which line integers are. I have a problem tomunderstand each line of numbers.
asked Dec 24, 2020 Mashhoodch 6.6k points
0 votes
1 answer 13 views
Problem: My code asks for data and fills it to the array. Then check if they are even. And it should print the data which is even. The data filling if you do it correctly. But at the time of printing I only get this - The number 0 in position [0] is even #include <iostream> using namespace std; int ... { cout << "The number" << * p ++ << "in position [" << i << "] is even \ n"; } } return 0; }
asked Dec 5, 2020 sasha 6.4k points
0 votes
1 answer 6 views
Problem: I'm trying to save a list (series) of numbers in a vector but I get an error in the "cin" of notes and I don't know how to solve it. Thank you. vector <double> notes {}; double n; cout << "Enter the number of students to add:" << endl; cin >> n; notes.resize (n); cout << "Enter your notes:" << endl; cin >> notes;
asked Dec 4, 2020 sasha 6.4k points
0 votes
1 answer 6 views
Problem: Hello programmers! I am a beginner and I have got an assginement in which I have to write a program in Java that will take a number from user as input and will check whether the user entered an even number or an odd number. The program is to be written in ... and I have no idea how to check if a number is even or odd using a program. Any help from you would be much appreciated. Thanks
asked Nov 27, 2020 Code Learner 5.5k points
0 votes
1 answer 8 views
Problem: The program deals with an ATM, which has 5 options: 1 check balance. 2 Withdraw money. 3 Deposit money. 4 show last 5 movements. 5 exit. My problem is in the last 5 movements, since I must save the data, that is, the inquiries withdrawals and deposits that the user makes, with ... in a moment ...." << endl; Sleep (10000); system ("cls"); menu_of_operations (); break; } } while (opc <5); }
asked Nov 5, 2020 sasha 6.4k points
0 votes
1 answer 32 views
Problem: The console screen of my C# program appears and immediately terminates automatically. I am unable to see the output. I am a noob and do not know what is happening. Can anybody guide me how to make the console screen wait for any key to be pressed in order to terminate the program?
asked Oct 11, 2020 Code Learner 5.5k points
0 votes
1 answer 13 views
I need to add items in cpmbox in C# windows application.
asked Oct 3, 2020 Daniel Anderson 4k points
0 votes
1 answer 275 views
How to convert non-finite calues to integer?
asked Sep 22, 2020 Daniel Anderson 4k points
0 votes
1 answer 17 views
Problem: At this very moment I am eagerly searching the way to read an integer which was given by a user from a command line or console project. I primarily know C++ and I also have recently started down with the C# path. I know that the Console.ReadLine() only takes the char/string. So in short now I am looking for the integer version of Console.ReadLine().
asked Sep 4, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 23 views
How do I delete / empty a C ++ array? There is , but it seems like it's only C ++ 11? I am using VC ++ 2010. How do I empty it (reset to all 0)?array::fill
asked Aug 31, 2020 sasha 6.4k points
0 votes
1 answer 34 views
Read a file line by line using ifstream in C ++ The contents of file.txt are as follows: 5 3 6 4 7 1 10 5 11 6 12 3 12 4 5 Where are the pairs of 3 coordinates? How to process this data line by line in C ++?
asked Aug 29, 2020 sasha 6.4k points
0 votes
1 answer 13 views
In an array the name of the array is a pointer to the array. So in iArray and & iArray [0] the same value is obtained. What I do not understand very well, is what is happening when I try to repeat this with myvector. int iArray [] = {1,2,3,4}; cout << ... [0] << endl; Print me different addresses. Working with vectors, is there any way to know where element 0 is, by the name of the vector?
asked Aug 17, 2020 game 4.6k points
0 votes
1 answer 19 views
I have to read a file that has this format: Id: 23 Name: Roberto Last Name: My Last Name Id: 24 Name: Roberto2 Last Name: My Last Name2 And I have to read that file to be able to work with that data but I don't know how to read it. I have a struct created as follows: struct Data {      int Id;      string Name;      string Surname; }; How do I go about having that data in an array?
asked Aug 17, 2020 game 4.6k points