expected declaration

Hello all,

I need to wright a program that asks for the price of several items and adds tax to them.
So item 1, 2 and 3 will get 21% taxes added. and Items 4, 5 and 6 wil get 9% taxes added.

as i am a beginner and started to wright the program I bumped into the first problem. it keeps saying "Expected declaration" and i have no idea what i've done wrong.

i really just started with it so it isnt much, but its honest work.

the problem occurs under void bedragartikel(): at the { sign

many thanks in advance!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <math.h>

using namespace std;

void bedragartikel();
void artikelcode();
void artikelcode21();
void artikelcode9();


int main()
{
	bedragartikel;
	artikelcode();
	
	int artikelcode1;
	cout << "Geef de artikelcode in\n";
	cin >> artikelcode1; 

	if (artikelcode1 > 6)
		cout << "geef een code lager dan 6\n"; 
	if (artikelcode1 <= 0)
		cout << "geef een code hoger dan 0, tussen 1 en 6\n";
	if (artikelcode1 <= 3)
		artikelcode21();
	if (3 < artikelcode1 <= 6)
		artikelcode9();


}


void bedragartikel();
{
	cout << "Geef de prijs van een artikel\n";
	cin >> bedragartikel;
		if (bedragartikel < 0)
		cout << "bedrag moet groter zijn dan 0\n";
		float bedragartikel
			rename(bedragartikel << bedragartikel1)
}
Last edited on
bedragartikel; <-- DO NOTHING STATEMENT. Use () to invoke it: (line 14)
bedragartikel();

line 34: no ; on this. The header (up top) has a ; but where the function body/code goes does not.

turn on warnings, read them, fix them.
if (3 < artikelcode1 <= 6)
you can't do this, c++ does not grok math.
you have to say it with boolean logic:
if( artikelcode1 <= 6 && artikelcode1 > 3)

<math.h> is a C language header. use <cmath> in c++ progarms.
Last edited on
Hello Rlabee,

If you have not seen this yet it may be of some help.
http://www.cplusplus.com/forum/beginner/272941/

Andy
thanks jonnin, really learned a thing or 2 thanks to your reply.

Handy andy, thanks, that is exactly what my assignment is. Havent seen it yet!

Thanks guys!
Topic archived. No new replies allowed.