Hi My name is C.D.,
I am currently taking C++ 1, I have an assignment that asks me to write a function that displays the prompt string and then reads a floating point number and then returns that number. The book gives an example of the code to use in the main. My problem is I have been trying for days to get the prompt part of the functon to show on the console and I can't figure out why it won't I have tried numerous ways. Here is my latest attempt that still does not work. the program accepts and returns the numbeer but I can not figure out how tho get the function to display the prompt. Please Help! Thank You, C.D.
#include <iostream>
#include <string>
using namespace std ;
double get_double(string Prompt)
{
string prompt ;
cout << prompt ;
double salary ;
cin >> salary ;
return salary ;
}
void main()
{
double salary = get_double("Please enter your salary $") ;
double perc_raise = get_double("What percentage raise would you like? ") ;
double new_salary = salary * (perc_raise / 100) + salary ;
cout << "If I give you that much of a raise you would be making $ " << new_salary
<< ".\nYou better be worth it \n" ;
system("PAUSE") ;
}