I have a class assignment of writing a program that:
Start with the following program code. Write the function called "increment" which takes one integer parameter and returns that value plus one.
#include
#include
using namespace std;
// YOUR FUNCTION GOES HERE!
int main()
{
int input;
string keepGoing;
do
{
cout << "Please enter an integer: ";
cin >> input;
cout << "Your number plus one is ";
cout << increment(input);
cout << endl << "Do you want to continue (yes or no)? ";
cin >> keepGoing;
} while ((keepGoing == "yes") || (keepGoing == "YES"));
}
so far, i have modified it to produce the following, but there are errors and i dont think i know how to fix this. can anyone please help?
#include <iostream>
#include <string>
using namespace std;
// put increment function here?
int increment(int x){
return ++x;
}
int main()
{
string keepGoing = "increment(keepGoing)";
int input, total = increment(keepGoing);
do
{
cout << "Please enter an integer: ";
cin >> input;
cout << "Your number plus one is ";
cout << increment(keepGoing);
cout << endl << "Do you want to continue (yes or no)? ";
cin >> keepGoing;
} while ((keepGoing == "yes") || (keepGoing == "YES"));
return (0);
}
THANKS!!! :)