Answer to Question #173242 in C++ for Dinesh kumar. M

Question #173242

Write a C++ code for the following pattern display using ios classes. The precision is set according to the value of variable x. (use setprecision(), setwidth(), setfill() ios flags and functions). 


1
Expert's answer
2021-03-19T11:13:29-0400
#include <iostream>
#include <conio.h>
#include <iomanip>  
using namespace std;

//The start point of the program
int main (){
	float x;
	//get the number from the user
	cout<<"Enter x: ";
	cin>>x;
	//Display result
	cout.width (10);
	cout.fill(' ');	
	cout<<fixed <<"Round number is: "<<setprecision(2)<<x<<"\n\n";
	//delay
	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS