Ok, I'm probly going to sound like a bit of an idiot, but I'm new to the programming world.
Whenever I attempt to run this program, I get a long list of error messages.
//DATATYPE.CPP
//Examples of variable declaration and
//initialization.
#include <iostream>
main ()
{
//declare a constant for the square root of two
const double SQUARE_ROOT_OF_TWO = 1.414214;
int i; //declare i as an integer
long j; //j as a long integer
unsigned long k //k as an unsigned long integer
float n; //n as a floating point number
i = 3; //initialize i to 3
j = -2048111; //j to -2048111
k = 4000000001; //k to 4000000001
n = 1.887; //n to 1.887
//output constant and variables to screen
cout << SQUARE_ROOT_OF_TWO << '\n';
cout << i << '\n';
cout << j << '\n';
cout << k << '\n';
cout << n << '\n';
return 0;
}
Whenever I try to run this, I get these error messages.
In function `int main()':
expected primary-expression before "unsigned"
`k' undeclared (first use this function)
[Warning] this decimal constant is unsigned only in ISO C90
`n' undeclared (first use this function)
`cout' undeclared (first use this function)