1 2 3 4 5 6 7 8 9 10 11 12

By way of comparison it was once noted: "this system took
45,000 lines of Ada, not counting the comments. The
C++ version was 18,000 lines of fully commented code.''
This may reflect the verbosity of Ada, compared to the
obscure terseness of C (e.g. the forstatement)


Trivial Differences between C and C++


comments/* ........ */
Can use// ........... to end of line in C++


Simple input/output


C has three pre-defined data streams
stdin, stdout, stderr


C++ has four pre-defined data streams
cin, cout, cerr and clog


cout << "Enter a number: ";
cout << "Enter a number:\n";
cout << "Enter a number:"; << endl;


while for input the converse:
cin >> N;// automatic "format" - type
cin >> C >> I >> R >> Z;//no ampersand &!
reads C, then I, then R and then Z from standard input, using
a format conversion that is appropriate for the declared
type of each variable.
char C;
int I;
Float R;
double Z;

March 2,1998

Page 7

C201 TAM/AGS