
-----------------------------------
deathscith
Fri Oct 17, 2008 11:38 pm

how to get user input in c++
-----------------------------------
how do i go about getting a user input in c++, i am only familiar with turing, which in this case of turing the statement would be get , how do i go about doing this in c++

-----------------------------------
md
Sat Oct 18, 2008 12:30 am

RE:how to get user input in c++
-----------------------------------
you want to look into the iosteam library, specidically std::cin and std::cout

However, I must re-iterate what everyone said in the other thread, waiting for input at the end of execution is horrible practice. Just run your program from the command line like it was meant to be run. You'll develop much better programming practices and be better for it.

-----------------------------------
deathscith
Sat Oct 18, 2008 12:58 am

Re: how to get user input in c++
-----------------------------------
yea, but i want to actually be able to see my program when its open, is it possible to add a delay before it shuts itself down? like in turing the 


delay (1000)


-----------------------------------
Ktomislav
Sat Oct 18, 2008 8:09 am

Re: how to get user input in c++
-----------------------------------
1. You don't need to use std::cin. You can use

using namespace std;
After including a library(s). And then you can just use
cin >>variable;
cout variable;
or System.Pause (not recommended).

-----------------------------------
wtd
Sat Oct 18, 2008 11:35 am

RE:how to get user input in c++
-----------------------------------
That is the same thing.  Concepts vs. syntax: you must understand the difference.

-----------------------------------
md
Sat Oct 18, 2008 11:45 am

Re: how to get user input in c++
-----------------------------------
yea, but i want to actually be able to see my program when its open, is it possible to add a delay before it shuts itself down? like in turing the 


delay (1000)


if you run your program from the command line then the window will not close when it's finished running. That is how command line programs are meant to be run.

-----------------------------------
deathscith
Tue Nov 11, 2008 12:12 pm

RE:how to get user input in c++
-----------------------------------
when you say command line, do you mean cmd? (i do my programming on a windows xp computer)

-----------------------------------
wtd
Tue Nov 11, 2008 3:11 pm

RE:how to get user input in c++
-----------------------------------
Yes.
