I'm trying to construct a program wherein the program will display a line of text, then the user is supposed to press enter, and then another line of text will appear. I have it all figured out except that I can't get the int variable for the cin to be anything other than numbers (sorry if I sound stupid). I would just like the enter key to make the program display the next line of text. Here is my source code thus far:
#include <iostream>
using namespace std;
int main()
{
int iRandom = 0;
cout << "Hey baby..." << endl;
cin >> iRandom;
cout << "How's it going?" << endl;
cin >> iRandom;
cout << "(self-censored for the purpose of this forum)" << endl;
Thank you, Mr/Ms Galik. Unfortunately though, that still only allows the user to type letters. I was hoping that the user could press the 'enter' or 'space' key instead so that the strings of text like, "Hey baby..." and "How's it going?" would not have anything between them, and yet would not all be displayed at once.
That will work for the enter and space keys also. But it will only take ONE key.
EDIT: Actually that wrong, you need to use this: cin.get();
If you want to be able to print separate outputs on the same line after an input then you need to use a special library. You can't really do that from the standard libraries.