mirror of
https://github.com/RustyRaptor/CS111-favorite-number.git
synced 2026-12-03 15:35:18 -07:00
26 lines
485 B
C++
26 lines
485 B
C++
|
|
|
|
#include <iostream>
|
|
|
|
// use the names int he standard library directly rather than having to call the
|
|
// stdlib manually each time.
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n;
|
|
|
|
cout << "What's your favorite number?, ";
|
|
// set n to the user's input
|
|
cin >> n;
|
|
|
|
// add one to n
|
|
n += 1;
|
|
|
|
|
|
cout << endl; // writes a newline
|
|
cout << "My favorite number is 1 more than that, " << n << endl;
|
|
cout << endl;
|
|
cout << endl << endl; // writes 3 new lines (kind of redundant)
|
|
|
|
return 0;
|
|
} |