Basic programming help

Hello,
I am kinda of stuck and needing help... I have to write a small mini program for class and I so far got this code but its not working and running, I can't figure out what to do with the 'startProgram' part, one classmate said to do a cin and cout but i already put it, can anyone help me on what is wrong?


#include <iostream>
#include <string>
using namespace std;
string getInput(string);
void start(string);
void getName(string);
void getAge(int);
void getMileage(double);
//declare variables
//input as string
string userInput = "";
//name as string
string name = "";
//age as integer
int age = 0;
//mileage as double
double mileage = 0.0;
int main ()
{
//call DisplayApplicationInformation
cout << "This program accepts user input as a string, then makes the appropriate data conversion." << endl;
start(startProgram);
getName(name);
getAge(age);
getMileage(mileage);


return 0;
}//call DisplayDivider(“Start Program”)
void start(string startProgram)
{
cout << startProgram << endl;
}//call DisplayDivider(“Get Name”)
void getName(string name)
{
//set name = GetInput(“Your Name”)
userInput = getInput("Your Name: ");
//display “Your name is: “ + name
getline(cin, userInput);
cout << "Your name is: " << name << endl;

}
//call DisplayDivider(“Get Age”)
void getAge(int age)
{
//set input = GetInput(“Your Age”)
userInput = getInput("Your Age: ");
//set age = convert input to integer
age = atoi(userInput.c_str());
//display “Your age is: “ + age
cout << "Your Age is: " << age << endl;
}
//call DisplayDivider(“Get Mileage”)
void getMileage(double mileage)
{
//set input = GetInput(“Gas Mileage”)
userInput = getInput("Gas Mileage: ");
//set mileage = convert input to double
mileage = atof(userInput.c_str());
//display “Your car MPG is: “ + mileage
cout << "Your car MPG is: " << mileage << endl;
}
First of all, please edit your post in order to include the code inside code tags. See http://cplusplus.com/articles/z13hAqkS/ for an explanation on how this is done.

Second, please be specific: Saying "is not working" and not saying WHY or at least describe the desired behavior is not helpful. "It is not working because it is doing this and I need it to do that instead". Something along that line. Also include any error messages that you may be getting either during runtime or during compilation.
Topic archived. No new replies allowed.