Sample Solution // I'm assuming the using std::cin, cout, etc has been done long starter; cout << "Please enter a value" << endl; cin >> starter; cout << "You entered " << starter << endl; |
Sample Solution r = top % bot; |
Sample Solution // this question should have said fixed instead of cin in the "... that uses ..." // so I didn't take marks off if folks neglected the << fixed part of the answer below // Here assuming the using std::cin, cout, etc has been done // note that setw has to be done for each columnized value, // whereas fixed and setprecision need only be done once cout << fixed << setprecision(3); cout << setw(13) << weight1 << endl; cout << setw(13) << weight2 << endl; cout << setw(13) << weight3 << endl; |
Sample Solution v1 = pow(v2,v3) + sqrt(v2+v3); |
Sample Solution
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
double userVal;
cout << "Please enter a real number" << endl;
cin >> userVal;
double half, third;
half = userVal / 2;
third = half / 3;
cout << "Half original is " << half << endl;
cout << "One third that value is " << third << endl;
return 0;
}
|