As mentioned I just got a new computer. In the process of moving files over from my old one, I’ve uncovered things I’ve written and forgotten about, including this bit of code from a college intro comp sci class I don’t really remember taking. Anyone want to hazard a guess as to what it does?
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
void Puppy (string); //prototypes
float Rug (float, float, float);
int main()
{
string name;
float num1, num2, price, prod;
cout.setf(ios::fixed | ios::showpoint);
//prompt for keyboard input
cout << “What is the name of your puppy? ” << endl;
getline ( cin, name );
Puppy (name);
cout << “What are the width and length of the damaged carpet (in feet)? ” << endl;
cin >> num1 >> num2;
cout << “What is the price per square foot of new carpeting? ” >> endl;
cin >> price;
Rug (num1, num2, price);
cout << “It will cost me $” << setprecision (2) << prod << ” to replace the carpet. GRRR!” \
<< endl;
return 0;
}
void Puppy ()
{
getline ( cin, name );
cout << “My new puppy, ” << name << “, just chewed a large hole in the carpet!” << endl <<\
“It looks like I will have to get a new one.” << endl << endl;
}
float Rug (float num1, float num2, float price)
{
float prod;
prod = num1 * num2 * price;
return prod;
}
Also found some homework that included the word “floppies.”
{ins << wistful sigh >>}