#include <iostream>
using namespace std;

void round();

int main()
{

void round();
{
	double input;
	double output;
	double first;
	double second;
	double third;
	double decimal_fix;

	cout << "Please enter the Number and the Places to round off" << endl;
	cin >> input;
	cout << "DEcimal places to fix" <<endl;
	cin >> decimal_fix;
	output  = input * 1000;

	first = output + .5;
	second = (float)first / 100;
	third = second / 10;
	cout << third << endl;


}	
	return 0;

}

right so i tired to run it and it would not round off to 2 decimal places as i want it to and also i wanted to put 10^n so that n would be the number of places to round off to but i am completely lost :S help please

Ancient Dragon commented: Thanks for using code tags correctly :) +36

You really need to tell us the real problem, which is "I cannot get the program to compile. The error message I get is..."

You cannot define a function within another function as you are doing. round() cannot be within main().

when i run my program it does not round off to 2 decimal places insted it goes to 3 and i would like to round off any number to 2 decimal places...i hope this helps

and thanx kumar i ll take a look at it

M3rcury: the code you original posted is worthless to us. Post the new code (all of it) that you are actually using and which is giving you problems.

And thanks for using code tags correctly, not many new posters bother to do that :) :)

well i am sort of lost any hints or anything that could help me :$

also how can i write 10^ 3 its giving me some error when i use this notation thanx for you help

>>also how can i write 10^ 3

How would you do it in your head? 10 times 10 times 10 right? Then do it the same way -- 10 * 10 * 10. or you could call the pow() function that's in math.h

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.