Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

Define the terms Grid and Warp in GPU

Answered: 1 week ago

Question

Draw a picture consisting parts of monocot leaf

Answered: 1 week ago