Differences Between String, Float, Double, and Int variables

if someone could please explain the differences in these and when you would use them versus the others that would be great.
This site has an excellent tutorial:
http://www.cplusplus.com/doc/tutorial/variables/
int is for integer variables like -7, 0, 1, 100, ...... it take 4 bytes in memory.If you assign int variable, for example 2.7(double), it will take the integer part(2).

double is for variables like 1.7, 0,7, 2.3 and others you also can assign an integer number.Double takes 8 bytes in memory.

float is similar to double the only difference is that it takes 4 bytes in memory.

String is useful when you work with string for example(std::string a = "Hello world";) it's size depend on how much characters you have remember that in c++ each symbol is 1 byte.

Hope I was useful)))
Topic archived. No new replies allowed.