Linked Questions
20 questions linked to/from getline not asking for input?
30 votes
3 answers
102k views
getline not working properly ? What could be the reasons? [duplicate]
Possible Duplicate: getline not asking for input? There is some unique thing happening in my program. Here are some set of commands : cout << "Enter the full name of student: "; // cin ...
23 votes
7 answers
23k views
Need help with getline() [duplicate]
Is there a reason why if in my program I am asking the user for input, and I do: int number; string str; int accountNumber; cout << "Enter number:"; cin >> number; cout << "Enter ...
-2 votes
2 answers
1k views
program skips over getline [duplicate]
When I run this program, and select option 1, it prints both cout statements in void CTree::Add() at once, jumping over the cin.getline(newPerson->name, 20); I had the same piece of code in ...
1 vote
2 answers
828 views
std::getline input not working properly in C++ [duplicate]
Possible Duplicate: Need help with getline() getline not asking for input? I am working on the following code: int main() { int num; string str; cin>>num; int points[num][...
-1 votes
2 answers
404 views
Problems with getline() function? [duplicate]
I have a problem with the getline function in the code below. In the "get" info section I want to be able to store a whole sentence, but I can't make it work. When I open up my program it just skips ...
0 votes
1 answer
232 views
String input error [duplicate]
Could you please help me determining what is wrong in my code again? Every time you select a case, for example you selected "1" which is "NBA Player", and you are asked who is your favorite player, ...
1 vote
1 answer
239 views
getline() gets bypassed without proper user input the first time [duplicate]
cout << "Type in your third message below:\n"; getline(cin, msgth); if (msgth.length() > 0 && msgth.length() < 500) {} else { system("cls"); cout << "Your message ...
0 votes
2 answers
111 views
Taking string input and printing it in C++? [duplicate]
int main() { string s1,s2; cout<<"1. "<<endl; cin>>s1; //to accept 1st string cout<<s1<<endl; cout<<"2. "<<endl; ...
3 votes
4 answers
26k views
Program skips second cin
I'm making a C++ Mind Reader program, which is nearly complete. However, it feels the need to skip the second cin. I've searched and I'm not exactly sure what's wrong. I've examined the code and I bet ...
3 votes
5 answers
39k views
Ignore Spaces Using getline in C++ [duplicate]
Hey, I'm trying to write a program that will accept new tasks from people, add it to a stack, be able to display the task, be able to save that stack to a text file, and then read the text file. The ...
3 votes
6 answers
14k views
How to get size c++ dynamic array
I'm studying C++ and I need to create structure Airplane and work with it. My structure Airplane.h #include "stdafx.h" using namespace std; struct Airplane { string destination; int number;...
2 votes
2 answers
12k views
Program is skipping over Getline() without taking user input [duplicate]
This is a very strange problem, when my program asks the user for the address, instead of waiting for input, it seems to skip the getline() function completely Answerinput: cout << "would you ...
2 votes
3 answers
8k views
input in c++ - cin.getline
#include<iostream> #include<cstdio> using namespace std; int main() { int T; char J[100], S[100]; int count=0; cin >> T; while(T--) { cin.getline(J,...
1 vote
3 answers
2k views
How can I insert text WITH SPACES into a text document in C++ using cin?
I am very new to programming and I am trying to write a program in C++ that will convert text inputted by the user into HTML code and output that code onto a text file. I have already written the ...
1 vote
3 answers
4k views
Shopping cart assignment, concepts on getline()
I've been working on a shopping cart assignment lately and couldn't understand why would this code below not work. I have to write a code that will output name, cost and quantity of items, for three ...