Many errors

There are many errors in this code. Can someone please fix them for me? I'd really appreciate it.

#include<iostream>
#include<string>

using namespace std;
int getans(string ans, char answer);




int main() {

int cor = 0, incor = 0;
string ans;
char answer;
getans(ans, answer);

cout << "1. Which of these Pokemon is a fairy type? \n a. Chansey \n b. Togepi \n c. Skitty \n";
cin >> answer[getans(ans)];

cout << "2. Which of these Naruto characters does NOT have a kekei genkai? \n a. Jiriya \n b. Kimimaru \n c. Sasuke \n";
cin >> answer[getans(ans)];

cout << "3. What does Kenshin say when he's confused? \n a. Uwah? \n b. oro? \n c. mowa? \n";
cin >> answer[getans(ans)];

cout << "4. What's the most annoying radio commercial ever? \n a. Geico \n b. Other insurance company \n c. Kars for kids \n";

cin >> answer[getans(ans)];

cout << "5. How do you defeat Primal Groudon? \n a. ground type moves \n b. water type moves \n c. grass type moves \n";

cin >> answer[getans(ans)];

cout << "You got " << cor << " answers right and " << incor << " answers wrong ";


system("pause");

}

int getans(string ans, char answer[5] = { "b", "a", "b", "c", "a" }) {



int cor = 0, incor = 0;

{

if (ans == answer){
cor++;
}
else
incor++;

return cor, incor;
}
}

Error 1 error LNK2019: unresolved external symbol "int __cdecl getans(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?getans@@YAHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main c:\Users\robot arena\documents\visual studio 2013\Projects\Final Project 2\Final Project 2\Source.obj Final Project 2

Error 2 error LNK1120: 1 unresolved externals c:\users\robot arena\documents\visual studio 2013\Projects\Final Project 2\Debug\Final Project 2.exe Final Project 2

3 IntelliSense: expression must have pointer-to-object type c:\Users\robot arena\Documents\Visual Studio 2013\Projects\Final Project 2\Final Project 2\Source.cpp 18 16 Final Project 2

4 IntelliSense: expression must have pointer-to-object type c:\Users\robot arena\Documents\Visual Studio 2013\Projects\Final Project 2\Final Project 2\Source.cpp 21 16 Final Project 2

5 IntelliSense: expression must have pointer-to-object type c:\Users\robot arena\Documents\Visual Studio 2013\Projects\Final Project 2\Final Project 2\Source.cpp 24 16 Final Project 2

6 IntelliSense: expression must have pointer-to-object type c:\Users\robot arena\Documents\Visual Studio 2013\Projects\Final Project 2\Final Project 2\Source.cpp 28 16 Final Project 2

7 IntelliSense: expression must have pointer-to-object type c:\Users\robot arena\Documents\Visual Studio 2013\Projects\Final Project 2\Final Project 2\Source.cpp 32 16 Final Project 2

8 IntelliSense: too many initializer values c:\Users\robot arena\Documents\Visual Studio 2013\Projects\Final Project 2\Final Project 2\Source.cpp 41 48 Final Project 2
Can you add code tags? It makes it easier to read. Do it like [ code] [/code]
And one thing, you have { in places they shouldn't be.
Last edited on
http://www.cplusplus.com/forum/general/149343/

and scroll down...

I still puzzle very hard with where someone thinks up

cin >> ans[func(ans)]

I guess if ans is properly initialized and func() returns a non negative value...this should evaluate completely, just looks strange to me =D

And still I don't think you can return more than one value from a function so ...

return cor, incor; is probably creating some trouble as well
Topic archived. No new replies allowed.