#include using namespace std; double computeScore(int right, int wrong); void prettyPrintInt(int x); void prettyPrintDouble(double x); void prettyPrintString(string s); int main(int argc, char *argv[]){ string first, handle; int correct, incorrect; cout << "Enter your first name :" << endl; cin >> first; cout << "Enter your game handle:" << endl; cin >> handle; cout << "Enter the number of correct dance steps you made:" << endl; cin >> correct; cout << "Enter the number of dance steps you missed:" << endl; cin >> incorrect; string partnerName, partnerHandle; int pc, pi; cout << "Enter your partner's first name :" << endl; cin >> partnerName; cout << "Enter your partner's game handle:" << endl; cin >> partnerHandle; cout << "Enter the number of correct dance steps your partner made:" << endl; cin >> pc; cout << "Enter the number of dance steps your partner missed:" << endl; cin >> pi; double score; prettyPrintString(first); prettyPrintString(handle); prettyPrintInt(correct); prettyPrintInt(incorrect); score = computeScore(correct, incorrect); prettyPrintDouble(score); cout << endl; prettyPrintString(partnerName); prettyPrintString(partnerHandle); prettyPrintInt(pc); prettyPrintInt(pi); score = computeScore(pc, pi); prettyPrintDouble(score); cout << endl; return 0; } double computeScore(int right, int wrong){ double computedScore = 100.0 - (100.0 * ((double) wrong / (double) (right + wrong))); return computedScore; } void prettyPrintInt(int x){ char tmp[21]; sprintf(tmp, "%10i", x); cout << tmp; return; } void prettyPrintDouble(double x){ char tmp[21]; sprintf(tmp, "%10.2lf", x); cout << tmp; return; } void prettyPrintString(string s){ char tmp[21]; sprintf(tmp, "%10s", s.c_str()); cout << tmp; return; }