| andrew73a (2) | |||
|
Hello everyone. I am currently writing a program for class and I was having some trouble. Please note I am not on here for someone to do my homework I am here to find out what I am doing wrong so I can fix it in the future. I am trying to write a program that will count the number of words a user enters and return that value. Here are the errors I am getting. 1>c:\users\altizer\documents\visual studio 2010\projects\wk 2 p2\wk 2 p2\week 2 prog 3.cpp(22): error C2065: 'times' : undeclared identifier 1>c:\users\altizer\documents\visual studio 2010\projects\wk 2 p2\wk 2 p2\week 2 prog 3.cpp(37): error C2562: 'numbered' : 'void' function returning a value I know the problems are 1. in the second function when I return times and 2. in the main function where it says "numbered(userstring, times);"
| |||
|
|
|||
| freddy92 (191) | |||
|
In your call to numbered in main, you're passing in times which has not been declared in that scope. From what your program is supposed to do, it seems you should just pass in ' ', as you want to get the number of words (note that there will likely by one more word than there are spaces, so watch out for that). As for numbered...
Lastly, your declaration of numbered before main doesn't have the same parameters as the function itself. | |||
|
|
|||
| andrew73a (2) | |
|
I am rewriting this but when I input (strPtr != null) it underlines numm and says it is undefined... it also wont let me put \0. I want it to say do times++ while strPtr != \0 this way it will increment the counter until it reacher null. | |
|
|
|