ERROR:IntelliSense: expected a ';

hello , i have this error : IntelliSense: expected a '; i use visual studio 2012
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
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <string>
#include <fstream>
#include <stdio.h>

using namespace std;

int main (char n[2])   
{
	string a,b,c;
	a=cin.get();      cin.get();
	char m[]={'C','D','E','F','G','A','B'};
	for (int k = 0; k < 6; k++)
	{
		n[1]=m[k];
		char transpose (char n);
		c=n;
    int pos ;
    do
    {
        pos = a.find(b);
        if (pos!=-1)  a.replace(pos, b.length(), c);
    }
    while (pos!=-1);
	b=m[k+1];
	cout<<a;
	return 0;
	}
char transpose(char arr2[])
{////////////////////////////////////////////// here i have this error
	int t,r;
	cout<<"Input transpose amount";
	cin>>t;
	char arr[21]={'C','D','E','F','G','A','B','C','D','E','F'
,'G','A','B','C','D','E','F','G','A','B'};
	
		for (int i = 0; i <20; i++)
		{
		if (arr2[1]==arr[i])
		break;
		}
			r=i+t;
			arr2[1]=arr[r];
			return arr2[1];
} 
Last edited on
line 10 - I'm getting a compiler error on your main argument
missing an argument? ( int main ( int argc, char *argv[] ) )

You're missing a closing brace somewhere in the main function. I'm not sure where the for loop is supposed to end? line 29 - This return 0 is actually within the for loop and that } on line 30 is closing the for loop. So the transpose function is currently trying to be defined within main.

line 44 - the i variable is declared only in the scope of the for loop.
Last edited on
ok tank you the program is running now
but compiler has problem with n[1]=m[k]; on line 17.
i upload a picture of my visual : http://www.sisicom.com/Screenshot%20(4).png

and the new code is :
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
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <string>
#include <fstream>
#include <stdio.h>

using namespace std;
char transpose(char arr2[]);
int main (char n[2])  
{
	string a,b="C",c;
	cout<<"Input your string : ";
	a=cin.get();      cin.get();
	char m[]={'C','D','E','F','G','A','B'};
	for (int k = 0; k < 6; k++)
	{
		n[1]=m[k];
		char transpose (char n);
		c=n;
    int pos ;
    do
    {
        pos = a.find(b);
        if (pos!=-1)  a.replace(pos, b.length(), c);
    }
    while (pos!=-1);
	{
	b=m[k+1];
	cout<<a;
	}
	}
	return 0;
}
char transpose( char arr2[1])
{
	int t,r,i;
	cout<<"Input transpose amount";
	cin>>t;
	char arr[21]={'C','D','E','F','G','A','B','C','D','E','F','G','A','B','C','D','E','F','G','A','B'};
	
		for (i = 0; i <20; i++)
		{
		if (arr2[1]==arr[i])
		break;
		}
			r=i+t;
			arr2[1]=arr[r];
			return arr2[1];
} 
Topic archived. No new replies allowed.