#include <iostream> #include <string> using namespace std; string GetName() { string FirstName, LastName, FN; cout << "Employee's First Name: "; cin >> FirstName; cout << "Employee's Last Name: "; cin >> LastName; FN = FirstName + " " + LastName; return FN; } int main() { string FullName; double Hours; double GetHours(string FullName); FullName = GetName(); Hours = GetHours(FullName); cout << "\nEmployee's Name: " << FullName; cout << "\nWeekly Hours: " << Hours << " hours\n\n"; return 0; } double GetHours(string FullName) { double Mon, Tue, Wed, Thu, Fri, TotalHours; cout << endl << FullName << "'s Weekly Hours\n"; cout << "Monday: "; cin >> Mon; cout << "Tuesday: "; cin >> Tue; cout << "Wednesday: "; cin >> Wed; cout << "Thursday: "; cin >> Thu; cout << "Friday: "; cin >> Fri; TotalHours = Mon + Tue + Wed + Thu + Fri; return TotalHours; }
Monday, 28 May 2012
Passing Arguments by Value
Labels:
c++programs
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment