Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

change the C++ code to C code #include <iostream> using std::cout; using std::ci

ID: 3615063 • Letter: C

Question

change the C++ code to C code
#include <iostream>
using std::cout; using std::cin; using std::ios;
#include <iomanip>
using std::setprecision; using std::setiosflags; using std::resetiosflags;
#include <cmath>
double roundToInteger( double ); double roundToTenths( double ); double roundToHundreths( double ); double roundToThousandths( double );
int main() { int count; double number;
cout << "How many numbers do you want to process?" << setiosflags( ios::fixed ); cin >> count;
for ( int i = 0; i < count; ++i ) { cout << " Enter number: ";
cin >> number; cout << number << " rounded to the nearestinteger is: " << setprecision( 0 ) << roundToInteger(number ) << ' ' << setiosflags( ios::showpoint ) << number << " rounded to the nearest tenthis: " << setprecision( 1 ) << roundToTenths(number ) << ' ' << number << " rounded to the nearesthundredth is: " << setprecision( 2 ) << roundToHundreths(number ) << ' ' << number << " rounded to the nearestthousandth is: " << setprecision( 3 ) << roundToThousandths(number ) << ' ' << resetiosflags( ios::showpoint ); }
return 0; }
double roundToInteger( double n ) { return floor( n + .5 ); }
double roundToTenths( double n ) { return floor( n * 10 + .5 ) / 10; }
double roundToHundreths( double n ) { return floor( n * 100 + .5 ) / 100; }
double roundToThousandths( double n ) { return floor( n * 1000 + .5 ) / 1000.0; }
#include <iostream>
using std::cout; using std::cin; using std::ios;
#include <iomanip>
using std::setprecision; using std::setiosflags; using std::resetiosflags;
#include <cmath>
double roundToInteger( double ); double roundToTenths( double ); double roundToHundreths( double ); double roundToThousandths( double );
int main() { int count; double number;
cout << "How many numbers do you want to process?" << setiosflags( ios::fixed ); cin >> count;
for ( int i = 0; i < count; ++i ) { cout << " Enter number: ";
cin >> number; cout << number << " rounded to the nearestinteger is: " << setprecision( 0 ) << roundToInteger(number ) << ' ' << setiosflags( ios::showpoint ) << number << " rounded to the nearest tenthis: " << setprecision( 1 ) << roundToTenths(number ) << ' ' << number << " rounded to the nearesthundredth is: " << setprecision( 2 ) << roundToHundreths(number ) << ' ' << number << " rounded to the nearestthousandth is: " << setprecision( 3 ) << roundToThousandths(number ) << ' ' << resetiosflags( ios::showpoint ); }
return 0; }
double roundToInteger( double n ) { return floor( n + .5 ); }
double roundToTenths( double n ) { return floor( n * 10 + .5 ) / 10; }
double roundToHundreths( double n ) { return floor( n * 100 + .5 ) / 100; }
double roundToThousandths( double n ) { return floor( n * 1000 + .5 ) / 1000.0; } #include <iostream>
using std::cout; using std::cin; using std::ios;
#include <iomanip>
using std::setprecision; using std::setiosflags; using std::resetiosflags;
#include <cmath>
double roundToInteger( double ); double roundToTenths( double ); double roundToHundreths( double ); double roundToThousandths( double );
int main() { int count; double number;
cout << "How many numbers do you want to process?" << setiosflags( ios::fixed ); cin >> count;
for ( int i = 0; i < count; ++i ) { cout << " Enter number: ";
cin >> number; cout << number << " rounded to the nearestinteger is: " << setprecision( 0 ) << roundToInteger(number ) << ' ' << setiosflags( ios::showpoint ) << number << " rounded to the nearest tenthis: " << setprecision( 1 ) << roundToTenths(number ) << ' ' << number << " rounded to the nearesthundredth is: " << setprecision( 2 ) << roundToHundreths(number ) << ' ' << number << " rounded to the nearestthousandth is: " << setprecision( 3 ) << roundToThousandths(number ) << ' ' << resetiosflags( ios::showpoint ); }
return 0; }
double roundToInteger( double n ) { return floor( n + .5 ); }
double roundToTenths( double n ) { return floor( n * 10 + .5 ) / 10; }
double roundToHundreths( double n ) { return floor( n * 100 + .5 ) / 100; }
double roundToThousandths( double n ) { return floor( n * 1000 + .5 ) / 1000.0; } cin >> number; cout << number << " rounded to the nearestinteger is: " << setprecision( 0 ) << roundToInteger(number ) << ' ' << setiosflags( ios::showpoint ) << number << " rounded to the nearest tenthis: " << setprecision( 1 ) << roundToTenths(number ) << ' ' << number << " rounded to the nearesthundredth is: " << setprecision( 2 ) << roundToHundreths(number ) << ' ' << number << " rounded to the nearestthousandth is: " << setprecision( 3 ) << roundToThousandths(number ) << ' ' << resetiosflags( ios::showpoint ); }
return 0; }
double roundToInteger( double n ) { return floor( n + .5 ); }
double roundToTenths( double n ) { return floor( n * 10 + .5 ) / 10; }
double roundToHundreths( double n ) { return floor( n * 100 + .5 ) / 100; }
double roundToThousandths( double n ) { return floor( n * 1000 + .5 ) / 1000.0; }

Explanation / Answer

please rate - thanks #include #include #include double roundToInteger( double ); double roundToTenths( double ); double roundToHundreths( double ); double roundToThousandths( double ); int main() { int count; double number; printf("How many numbers do you want to process? "); scanf("%d",&count); for ( int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote