# i need help deciding the type of variable to use

• 10-27-2010
njmbb8
i need help deciding the type of variable to use
hello and thanks in advance for helping (or even taking a look) I am making a program to calculate various physics problems and at the start of the program i would like the user to specify the are of physics that they're problem is in but how would i set up a variable that is words?

this is what i have so far:

Code:

```#include <iostream> using namespace std; int main() {     variable         cout << "Welcome to the All in One Physics Calculator written by me!\n";     cout << "to begin type area of physics that your problem is in.\n" << "\n";     cout << " big 4 \n";     cout << " projectile motion \n";     cout << " collisions \n";     cin >> variable;                 return 0; }```
• 10-27-2010
bithub
Use an integer.
Code:

```#include <iostream> using namespace std; int main() {     int variable         cout << "Welcome to the All in One Physics Calculator written by me!\n";     cout << "to begin type area of physics that your problem is in.\n" << "\n";     cout << "1) big 4 \n";     cout << "2) projectile motion \n";     cout << "3) collisions \n";     cin >> variable;                 return 0; }```
• 10-27-2010
njmbb8
ok now i need help one more (and hopefully the last) time can a double type variable handle a number with no decimal or does there have to be a .0 at the end of integers?
• 10-28-2010
Elysia
A double can handle any natural numbers. That is, numbers with no decimal.
• 10-28-2010
cpjust
Quote:

Originally Posted by Elysia
A double can handle any natural numbers. That is, numbers with no decimal.

That's half true. It can handle natural numbers, but it can also handle numbers with decimals. (Just so there's no confusion)