Retrieve the Value of An Integer Variable
- by Abluescarab
This is probably easily figured out (I feel very stupid right now), but I can't find a solution anywhere, for some reason. Perhaps I'm not searching for the right thing. And maybe it's in some beginner tutorial I haven't watched.
Anyway, I was wondering how to retrieve the value of an integer variable in C++? I know you can use cin.getline() for string variables, but I received an error message when I attempted that with an integer variable (and rightfully so, I know it was wrong, but I was looking for a solution).
My project is a Win32 console application. What I'm trying to do is ask a user to input a number, stored in the variable n. Then I take the value of n and perform various math functions with it. In my header file, I have string, windows, iostream, stdio, math, and fstream. Do I need to add another library?
There's not much more to tell. I can post my code if I must.
EDIT:
cout << "TEST SINE";
cout << "\nPlease enter a number.\n\n";
cin >> n;
break;
Here's the code I'm trying to use. Is this all I need to do? If so, how do I incorporate the variable so I can test it using sin, cos, and tan?
Yet again, thanks ahead of time.