// demonstrates function usage - function is used before definition // prototype needed // Mikhail Nesterenko // 9/27/07 #include using std::cin; using std::cout; using std::endl; int add1(int); // increments the argument int main() { char answer='y'; // check if user wants to continue do{ // get the number cout << "Enter a number: "; int n; cin >> n; // find the number plus 1 int newn = add1(n); // print out the number plus 1 cout << newn << endl; cout << "Do another number? (y/n) "; cin >> answer; }while(answer=='y'); } // increments the argument int add1(int i) { return i+1; }