The program fails to display `cout` when it is run
- by Jeff - FL
Hello,
I justed started a C++ course & I wrote, compiled, debugged & ran my first program:
// This program calculates how much a little league team spent last year to purchase new baseballs.
#include <iostream>
using namespace std;
int baseballs;
int cost;
int total;
int main()
{
baseballs, cost, total;
// Get the number of baseballs were purchased.
cout << "How many baseballs were purchased? ";
cin >> baseballs;
// Get the cost of baseballs purchased.
cout << "What was the cost of each baseball purchased? ";
cin >> cost;
// Calculate the total.
total = baseballs * cost;
// Display the total.
cout << "The total amount spent $" << total << endl;
return 0;
}
The only probelm that I encountered was that when I ran the program it failed to display the total amount spent (cout). Could someone please explain why?
Thanks
Jeff H - Sarasota, FL