COM SCI 31 Lecture Notes - Lecture 4: Uninitialized Variable, Newline, Negative Number
Document Summary
/* will print a garbage, unpredictable value didn"t initialize g output is a leftover value from an earlier computation most common garbage value for uninitialized variable is 0 but not always 0. Sir robin is delivered to program cout << what is your quest? string quest; getline(cin, quest); cout << hello, brave << personsname << ! If you live, next year you will be 33. #include // i/o = input/output. cout, cin, endl, etc. Sir robin is delivered to program cout << how old are you? int age; cin >> age; cin. ignore(10000, /n"); /* explained below. put it in right after reading in number before reading in next string. << endl; cout << you want << quest << endl; cout << if you live, next year you will be << (age + 1) << endl; //without parentheses, does plus operator have less precedence than < safer just to put parentheses. although + does have higher precedence than output: