ten signs line

Hallo!
Please, what is wrong with that program:

#include <iostream>
using namespace std;
int main()
{
int=a;
for (int a=1; a<=10; a++)
switch(a)
{
case:'1':
cout<<"*";
break;

default:
cout<<"-";
break;

}
a=a++;
return 0;
}


what is "parse error"?(in this case!)
Thanks!
Last edited on
int=a;

This line is wrong.

If you want to just declare a variable, you do not use the = operator. You simply do it like so:

 
int a;


HOWEVER, a is already declared on the line below that (in your for loop), so you can erase this line completely.
Thanks, I erased it .

NOw Ihave folowing errors:

1.
C:\Dev-Cpp\xx.cpp
[Warning] In function `int main()':

2.
9 C:\Dev-Cpp\xx.cpp
parse error before `:' token

3.
15 C:\Dev-Cpp\xx.cpp
name lookup of `a' changed for new ISO `for'

4.
6 C:\Dev-Cpp\xx.cpp
using obsolete binding at `a'

5.
10 C:\Dev-Cpp\xx.cpp
[Warning] unreachable code at beginning of

6.
C:\Dev-Cpp\Makefile.win
[Build Error] [xx.o] Error 1


What now?

Last edited on
syntax errors, try:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
using namespace std;

int main()
{
    int a=0;
    for (int a=1; a <= 10; a++)
    {
    switch(a)
    {
    case 1:
    cout << "*";
    break;

    default:
    cout <<"-";
    break;
    }
    }
return 0;
}
Last edited on
It works!!!!Thank U!!!
Last edited on
Topic archived. No new replies allowed.