Hello, i need help with a basic code issue, i ave posted the code here because it is too long to post...

The issue occurs in this section of code:
...(more before)
void getInput(int num){
char = one[1];
char = two[1];
char = three[1];
char = four[1];

...(more after)

saying it is expecting something before the keyword "char"
i am using Dev C++(Latest) as a compiler, and yes, i had i as the following at one point:

char[5]xxx;

((Example Variable))

Any and all help is appreciated.

Thanks

I have no idea what you're trying to do in that code, but "char" is a data type, so you're trying to set a data type (as opposed to a variable) equal to "something."

That "something" is the first element of an array called one, two, three, four, five, six, seven, eight, nine, ten, eleven and twelve. You don't appear to have any arrays by those names declared.

Later in the function, you are trying to read input into some sort of variables with those same names, which also appear not to be declared.


Please explain very clearly what you are trying to do, either in this thread or in comments within your code. I think that you've got a lot more problems with your code than just the lines you mentioned in the OP!

There are two problems on each of those lines
1) one, two, three, etc are not defined in that function.

2) char is a data type, but you failed to provide a variable name. For example char something = 1; [edit]What ^^^ said too :)

Is there a way to create a "String" in CPP then? (Something like the String data type in JAVA)

[edit] Any answer from either of you would be nice (or both if you feel the need)

c++ has std::string that is declared in <string> header file. google for std::string and you will find links that describe all its methods.

Ok, thanks

If you happen to be using MFC, the CString class is incredibly useful as well.

FWIW, there is apparently also a womens' undergarment called a CString, so be careful googling in polite company :D

Thank You

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.