I am working with a structure and switch statements as part of a homework assignment, but for no explainable reason, it is giving me the error
"; missing before ." Which is nonsense. Not only that, it gives these errors twice each for the same line.
Here is short example of the switch statement I am using.
1 2 3 4 5 6 7 8
|
switch (key) //key is type char.
{
case '1':
case '2':
case '3':
phoneTones.rowTone = 679; //phoneTones is the name of the structure, and rowTone is one of the members of the structure.
break;
}
|
For the next one, I am dealing with I/O again, this time using arrays.
I dunno where the logic error in my program is, but for some reason, the output file is blank when the arrays themselves are not. Here is example of how I am using the of_stream.
|
writing << idArray[i] << storeNum[i] << qtyArray[i] << endl;
|
When checking the output file from this, it is blank, and it should not be. What could be causing this? Cause everything else works fine before that point.
Then with the next one, I am getting the Linker Error LNK2019. One of my functions: overTime, is mentioned as the cause of it. The problem is, I have it's function prototype, correctly stated no less, before the main function as follows.
|
int overTime (const worker g[], int numb);
|
and it is implemented in the main function as follows.
|
int over = overTime (workr, number); // workr is the instance of the worker structure, number is a //previously declared int variable.
|
I have no idea what could be causing this error, here is the function as follows.
1 2 3 4 5 6 7 8 9 10 11 12
|
int overTime (const worker g[], numb)
{
int count = 0;
for(int i = 0; i < numb; i++)
{
if(g[i].hourworked < 40)
continue;
else
count++;
}
return count;
}
|
I have another program, named hangman, which was given as a previous assignment. The problem is that, for some reason, one of the functions doesn't work as I think it logically should from looking at the code. Here is the function:
1 2 3 4 5 6 7 8 9 10
|
void updateTemplate(const char secretword[], char guessLetter, guessTemplate[])
{
for(int i = 0; guessTemplate[i] != '\0'; i++)
{
if(secretword[i] == guessLetter)
guessTemplate[i] = guessLetter;
else
continue;
}
}
|
I am currently at a loss for why this function is not working properly right now.
Currently these are the main things that are holding me up from completing all of my assignments for this semester, and I sorely do not wish to fail.