<<split>>

so you did get your program to work then???
i am running into the same problem. i get this error
\prob 3.cpp(15) : error C2447: '{' : missing function header (old-style formal list?)
but my programs heading looks just like all i have seen and i cant find anything wrong with the program either. The error is pointing at an empty line.

It's pointing at the line marked as #3 in here.

#include <iostream>
using namespace std;

float main();
{
	float income, tax;
	int status;

	cout<<"***WELCOME***\n"
		<<"Enter your income for the year\n";
	cin>>income;

	cout<<"Enter\t1.) If single\n"
		<<"\t2.) If married\n";
	cin>>status;

	while (status=1)
	{ 
		if (income <0)
			cout<<"***Error!!!!!*** \n Enter a  positive amount\n";

		else if (income <21450)
			tax=income*0.15

		else if (income <51900)
			tax= 3217.5 + 0.28*income

		else if (income >=51900)
			tax=11743.5+0.31*income

	}//end of single while loop


	while (status=2)
	{
		if (income<0)
			cout<<"***Error!!!!!*** \n Enter a  positive amount\n";

		else if(income<35800)
			tax=income*0.15

		else if (income <86500)
			tax= 5370.00 + 0.28*income

		else if (income >=86500)
			tax=19566.00+0.31*income

	}//end of married while loop

cout<<"Tax to pay is "<<tax<<endl;


return 0;

}// end of main

Edited 6 Years Ago by Nick Evan: fixed tags, split thread

You've got two obvious problems on 1 line : float main(); . It's defined as int main() and you have put a semicolon ( ; ) right after it which will result in the errormessage you got. Change it to int main()

I actually already fixed this and the error remains. The pointer says the error is in the line previous to main. In my program the main() line is line 14.

You've got two obvious problems on 1 line : float main(); . It's defined as int main() and you have put a semicolon ( ; ) right after it which will result in the errormessage you got. Change it to int main()

>>while (status=2)

Use the boolean == operator there, not the assignment = operator.

>>The pointer says the error is in the line previous to main.
The line previous to main() is a blank line. Repost your current code so that we can see what you are talking about.

Edited 6 Years Ago by Ancient Dragon: n/a

Thank you so much I wasn't sure if to use that == or the single one.

The only thing that is different is the main line. I changed it to
Int main()
I didn't post the previous lines because they are headings (comments), information for my class, such as name and section #.
I know the line is empty, that's why I don't know what to do. It is as you see it here, the line before main(), that's #13.

Thank you!

>>while (status=2)

Use the boolean == operator there, not the assignment = operator.

>>The pointer says the error is in the line previous to main.
The line previous to main() is a blank line. Repost your current code so that we can see what you are talking about.

But I don't have any new code. As I said I only changed the main line. And I cannot post the personal information in the headings. I think aside from all I have been very clear about the problem and its location as to been able to get an answer if somebody knows how to solve it.

I installed c++ a few days ago and wrote another code previous to this one and I still got the same error in the same line (previous to main). I still submitted it because I could'nt find what was wrong with it and the prof said I had a compiler error.

Without seeing your newest code, we can't really help you.

You don't have to post the personal information contained within the comment block(s), omit that part when you post your code. That's an issue that is pretty simple to figure out.

It is important to be clear, which you have been. But without the code, all the clarity in the world means nothing. It's not possible for us to help you much further without seeing any relevant code. In this instance, "relevant code" is the most current version of what you have (excluding the personal information).

In this post you mentioned you changed the definition of main() to Int main(). This is not correct and definitely is a problem. C++ is case sensitive, the proper version is int main(). But without your code, we can't say for sure if this is the only problem.

Edited 6 Years Ago by Fbody: n/a

Your program is missing a lot of ; statement terminators, such as the one on line 23 of the code you originally posted (there are several lines like that).

My compiler vc++ 2008 Express also coughs up warnings about assigning doubles to floats because you didn't add 'F' after a magic number, such as the 0.15 on line 23, instead of 0.15F. One easy fix for that is to declare variables as double instead of float.

This article has been dead for over six months. Start a new discussion instead.