Publicité

# Hi- can someone help me solve this program in c++ style with the two d.docx

24 Feb 2023
Prochain SlideShare
2.overview of c++ ________lecture2
Chargement dans ... 3
1 sur 2
Publicité

### Hi- can someone help me solve this program in c++ style with the two d.docx

1. Hi, can someone help me solve this program in c++ style with the two different outputs in the same program? Function ConvertValue() takes one integer parameter. Define the second ConvertValue() function to take two integer parameters, dollars and cents, and returns the total number of cents. Ex: If the input is 8 17, then the output is: Note: The total number of cents can be found using (dollars * 100) + cents. Given this program: #include <iostream> using namespace std; int ConvertValue(int dollars) { return dollars * 100; } /* Your code goes here */ int main() { int dollarsUsed; int centsUsed; int totalCents1; int totalCents2; cin >> dollarsUsed; cin >> centsUsed; totalCents1 = ConvertValue(dollarsUsed); cout << dollarsUsed << " dollars yields " << totalCents1 << " cents." << endl; totalCents2 = ConvertValue(dollarsUsed, centsUsed); cout << dollarsUsed << " dollars and " << centsUsed << " cents yields " << totalCents2 << " cents." << endl; return 0; }
Publicité