Basic C++ Program
Quote:
#include
int main(void)
{
cout << ?Hello, this is my first C++ program? << endl;
return 0;
}
int main(void)
{
cout << ?Hello, this is my first C++ program? << endl;
return 0;
}
Data Types and Variable names
Quote:
#include
int main(void)
{
double x = 3.5;
int i = 10;
char c = ?B?;
// the following three lines works fine:
x = x + 2*x; // x has the new value 10.5
double y = x + i; // y has the value 13.5
double z = 12345610E32; // z has large range
// the following two lines is not okay:
int j = x + i; // can not store double as an int
int k = 1234567890123456790; // range of k is not large enough
return 0;
}
int main(void)
{
double x = 3.5;
int i = 10;
char c = ?B?;
// the following three lines works fine:
x = x + 2*x; // x has the new value 10.5
double y = x + i; // y has the value 13.5
double z = 12345610E32; // z has large range
// the following two lines is not okay:
int j = x + i; // can not store double as an int
int k = 1234567890123456790; // range of k is not large enough
return 0;
}
No comments:
Post a Comment