Question: A Version of this program is being used for the Assembly Class. Your job is to convert it from C++ to C. # # Program:
A Version of this program is being used for the Assembly Class. Your job is to convert it from C++ to C. # # Program: SyntaxVariablesIO.c # Author: ********** # Date: mm/dd/yy # Purpose: Practice printing data types using printf #----------------------------------------------------------------- # Create c program for the following, using printf statements formatted properly # ------------------- # #include // Replace with #include # #include // Remove # using namespace std; // Remove # # void main() # { # char myname[] = "Your Name"; # float age = 23.2; // Age down to the month # float gpa = 3.5; // Fictitious GPA to one decimal place # double pi = 3.1415926535897; # char gender = 'F'; # // Replace all of the following with corresponding printf statements. # cout << "Name:\t\t" << myname << endl; # cout << "Age:\t\t" << age << endl; # cout << "GPA:\t\t" << gpa << endl; # cout << "PI:\t\t" << pi << endl; # cout << "Gender:\t\t" << gender << endl; # cout << "Has Programmed:\t\t" << hasProgrammed << endl; # cout << "Week Miles Gallons MPG" << endl; # cout << ----- ----- ------- ---" << endl; # cout << 1 << " " << 23.2 << " " << 302 << " " << 13.01724138 << endl; # cout << 2 << " " << 32.06 << " " << 423.2 << " " << 13.20024953 << endl; # cout << 3 << " " << 20.25 << " " << 355.82 << " " << 17.57135802 << endl; # } # Modify your program so the output is pretty like below. Notice the decimals line up # You MUST use Format Strings. You cannot have any \t and you cannot use multiple # spaces. i.e. This is not allowed # printf("Name: My Name "); # it has to be something like # printf("Name: %10s ",myname); # # Formatted Output Below (line up by the decimal point) Name: My Name Age: 23.2 GPA: 3.50 PI: 3.14 Gender: F Week Miles Gallons MPG ---- ----- ------- --- 1 23.2 302 13.017 2 32.06 423.2 13.20 3 20.25 355.82 17.57 Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
