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!

Edited 7 Years Ago by donaldw: n/a

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 :)

Edited 7 Years Ago by Ancient Dragon: n/a

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)

Edited 7 Years Ago by turtlez: n/a

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.

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

Edited 3 Years Ago by happygeek: fixed formatting

This article has been dead for over six months. Start a new discussion instead.