201 [Error] expected unqualified-id before 'if'

Here is the code it's very big .
There's an error on the 201 line so if you can help i would appreciate that . :)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#include <iostream>
#include <fstream>
#include <cstring>


using namespace std;

int prosli(int dd,int mm,int gg)
{
	int i;
	int pd,pm,pg;
	bool tridesetjedan,trideset,dvadesetdevet,dvadesetosam;
	bool prestupna=false;
	if((gg%400==0)||(gg%100==0)&&(gg%4==0))
	{
		prestupna=true;
	}
	// Odredjivanje dani u mjesecima.
	for(i=0;i<12;i++)
	{	if (i==mm)
		{
	
			if((i==1)||(i==3)||(i==5)||(i==7)||(i==8)||(i==10)||(i==12))
			{
				tridesetjedan=true;	
			}
			if((i==4)||(i==6)||(i==9)||(i==11))
			{
				trideset=true;	
			}
			if((i==2)&&(prestupna==true))
			{
				dvadesetdevet=true;
			}
			if((i==2)&&(prestupna==false))
			{
				dvadesetosam=true;
			}
		}
	}
	// Kad je 31 dan
	if (tridesetjedan=true)
	{
		// Za sve obicne dane 31-danskog mjeseca
		if((dd>1)&&(dd<31))
		{
			pd=dd-1;
			pm=mm;
			pg=gg;
		}
		// Za sve krajnje datume 1.mart npr. osim nove godine
		if((dd==1)&&(mm!=1))
		{
			// U ovome izuzeci:
			if((mm==8))
			{
				pd=31;
				pm=mm-1;
				pg=gg;
			}
			if((mm!=1)&&(mm!=3)&&(mm!=8))
			{
				pd=30;
				pm=mm-1;
				pg=gg;
			}
			
		}
		/////////////////////////////////////////////////////////
		// Nova godina
		if((mm==1)&&(dd==1))
		{
			pd=31;
			pm=12;
			pg=gg-1;
		}
		///////////////////////////
		
	}
	if (trideset==true)
	{
		// Za sve obicne dane 31-danskog mjeseca
		if((dd>1)&&(dd<30))
		{
			pd=dd-1;
			pm=mm;
			pg=gg;
		}
		// Za sve krajnje datume 1.juni.. npr. osim nove godine
		if((dd==1)&&(mm!=1))
		{
			{
				pd=31;
				pm=mm-1;
				pg=gg;
			}
		}
	}
	if (dvadesetdevet==true)
	{
		if((dd>1)&&(dd<29))
		{
			pd=dd-1;
			pm=mm;
			pg=gg;
		}
		// Za sve krajnje datume 1.februar npr. osim nove godine
		if((dd==1)&&(mm==2))
		{
			{
				pd=31;
				pm=mm-1;
				pg=gg;
			}
		}
	}
	if (dvadesetosam==true)
	{
		if((dd>1)&&(dd<28))
		{
			pd=dd-1;
			pm=mm;
			pg=gg;
		}
		// Za sve krajnje datume 1.februar npr. osim nove godine
		if((dd==1)&&(mm==2))
		{
			{
				pd=31;
				pm=mm-1;
				pg=gg;
			}
		}
	}
	return pd,pm,pg;
}

int iduci(int dd,int mm,int gg)
{
	int i;
	int id,im,ig;
	bool tridesetjedan,trideset,dvadesetdevet,dvadesetosam;
	bool prestupna=false;
	if((gg%400==0)||(gg%100==0)&&(gg%4==0))
	{
		prestupna=true;
	}
	// Odredjivanje dani u mjesecima.
	for(i=0;i<12;i++)
	{	if (i==mm)
		{
	
			if((i==1)||(i==3)||(i==5)||(i==7)||(i==8)||(i==10)||(i==12))
			{
				tridesetjedan=true;	
			}
			if((i==4)||(i==6)||(i==9)||(i==11))
			{
				trideset=true;	
			}
			if((i==2)&&(prestupna==true))
			{
				dvadesetdevet=true;
			}
			if((i==2)&&(prestupna==false))
			{
				dvadesetosam=true;
			}
		}
	}
	// Kad je 31 dan
	if (tridesetjedan=true)
	{
		// Za sve obicne dane 31-danskog mjeseca
		if((dd>1)&&(dd<31))
		{
			id=dd+1;
			im=mm;
			ig=gg;
		}
		// Za sve krajnje datume 1.mart npr. osim nove godine
		if((dd==31)&&(mm!=12))
		{
				id=1;
				im=mm+1;
				ig=gg;
			}
			
		}
		/////////////////////////////////////////////////////////
		// Nova godina
		if((mm==12)&&(dd==31))
		{
			id=1;
			im=1;
			ig=gg+1;
		}
		///////////////////////////
		
	}
	if(trideset==true)
	{
		// Za sve obicne dane 31-danskog mjeseca
		if((dd>1)&&(d<30))
		{
			id=dd+1;
			pm=mm;
			pg=gg;
		}
		// Za sve krajnje datume 1.juni.. npr. osim nove godine
		if((dd==30))
		{
			{
				id=31;
				im=mm;
				ig=gg;
			}
		}
	}
	if (dvadesetdevet==true)
	{
		if((dd>1)&&(dd<29))
		{
			id=dd+1;
			pm=mm;
			pg=gg;
		}
		// Za sve krajnje datume 1.februar npr. osim nove godine
		if((dd==29)&&(mm==2))
		{
			{
				id=1;
				im=mm+1;
				ig=gg;
			}
		}
	}
	if (dvadesetosam==true)
	{
		if((dd>1)&&(d<28))
		{
			id=dd+1;
			im=mm;
			ig=gg;
		}
		// Za sve krajnje datume 1.februar npr. osim nove godine
		if((dd==28)&&(mm==2))
		{
			{
				id=1;
				im=mm+1;
				ig=gg;
			}
		}
	}
	return id,im,ig;
}

int main()
{
	cout<<"Unesite datum"<<endl;
	cin>>dd>>mm>>gg;
    cout<<"Prethodni datum je : "<<prosli(dd,mm,gg)<<endl;
    cout<<"Sljedeci datum je : "<<iduci(dd,mm,gg)<<endl;
    return 0;
 }
closed account (Dy7SLyTq)
remove line 187 if ur interested i can tell you why it said 201
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
	// Kad je 31 dan
	if (tridesetjedan=true) //you meant == here
	{
		// Za sve obicne dane 31-danskog mjeseca
		if((dd>1)&&(dd<31))
		{
			id=dd+1;
			im=mm;
			ig=gg;
		}
		// Za sve krajnje datume 1.mart npr. osim nove godine
		if((dd==31)&&(mm!=12))
		{
				id=1;
				im=mm+1;
				ig=gg;
			} //this should not be here
			
		}
		/////////////////////////////////////////////////////////
		// Nova godina
		if((mm==12)&&(dd==31))
		{
			id=1;
			im=1;
			ig=gg+1;
		}
		///////////////////////////
		
	}
	if(trideset==true)
	{
Last edited on
haha lol . thnx
Last edited on
closed account (Dy7SLyTq)
so the compiler doesnt care about syntax. so when you put that in it pushed all of the } to go with the outer if and then you ended up with an extra one way far down because it had nothing to close
I think you meant "the compiler doesn't care about spacing", unless you're saying compilers don't have emotion and therefore cannot care about syntax emotionally like code fetishests do.
closed account (Dy7SLyTq)
compilers must have emotion cause they love giving weird errors cause i forgot a semicolon. i kid you not i got a page full of errors becuase i tried passing bool instead of a char or something like that
Your compiler is outdated or you're working with templates. Most compilers are smart enough these days to plain out tell you that you forgot a semicolon.
Topic archived. No new replies allowed.