Hiya,
1. i don't see any functions in there. Do you mean that this is the code before you tried to do that?
2. Having a semi-colon at the end of an if is bad, like you've done here:
the correct structure would be something like this:
1 2 3 4 5 6 7 8
|
if (logan != 0)
{
// do something
}
else
{
// else do something else
}
|
3. Incrementing variables at the end of your main function doesn't really do anything as your program is about to terminate, so:
before your 'return 0' isn't doing anything.
4. You can't read into a string like this:
cin >> thanos;
take a look here:
http://www.cplusplus.com/reference/string/string/getline/
(and add #include<string> at the top of your code as well)
5. You have a loop that seems to increment 'rogers' and 'stark', which is okay BUT then at the start of the next loop you reset these variables to zero again, so they will not increment. Better to initiliase these variables outside the loop like you're done with 'logan' and 'i'.
6. to find the length of a string simply do something like this:
|
int strLength = thanos.size();
|
no need for those incrementing for loops.