C++ help
|
Author |
Message |


Normal Egg
Member Lvl: 7
Egg Points: 12187
Posts: 307
|
| Posted: Nov 13, 2006 7:11 p.m. - Subject: C++ help |
| |
I’m currently learing C++ in school, and I am working on a program that creates 25 random numbers between 1 and 25, then sorts them even and odd.
like so:
Even: (all even nums)
Odd: (all odd nums)
I get no errors when compiling, but when linking I get the following errors:
C08E01.OBJ : error LNK2001: unresolved external symbol "public: bool & __thiscall vector::operator[](int)" (??A?$vector@_N@@QAEAA_NH@Z)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: int & __thiscall vector::operator[](int)" (??A?$vector@H@@QAEAAHH@Z)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: __thiscall vector::~vector(void)" (??1?$vector@_N@@QAE@XZ)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: __thiscall vector::~vector(void)" (??1?$vector@H@@QAE@XZ)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: __thiscall vector::vector(class vector const &)" (??0?$vector@H@@QAE@ABV0@@Z)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: __thiscall vector::vector(class vector const &)" (??0?$vector@_N@@QAE@ABV0@@Z)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: __thiscall vector::vector(void)" (??0?$vector@_N@@QAE@XZ)
C08E01.OBJ : error LNK2001: unresolved external symbol "public: __thiscall vector::vector(void)" (??0?$vector@H@@QAE@XZ)
Debug/C08E01.exe : fatal error LNK1120: 8 unresolved externals
Error executing link.exe.[/code]
Code in next post.
|


Normal Egg
Member Lvl: 7
Egg Points: 12187
Posts: 307
|
| Posted: Nov 13, 2006 7:13 p.m. - Subject: |
| |
here is my code:
[code]#include
#include
#include
typedef int VarType;
int RandNum()
{ VarType Num;
randomize();
Num=random(15+1);
return(Num);
}
int SortNums(vector &NumberArray, vector &TrueFalse)
{
for(int i=0;i=24;i++)
NumberArray[i]=RandNum();
for(i=0;i=24;i++)
{ if(NumberArray[i]%2==0)
TrueFalse[i]=true;
else
TrueFalse[i]=false;
}
return(0);
}
void DisplayNums(vector NumberArray, vector TrueFalse)
{ cout
|


Normal Egg
Member Lvl: 7
Egg Points: 12187
Posts: 307
|
| Posted: Nov 13, 2006 7:14 p.m. - Subject: |
| |
wtf it got cut off
|


Normal Egg
Member Lvl: 7
Egg Points: 12187
Posts: 307
|
| Posted: Nov 13, 2006 7:16 p.m. - Subject: |
| |
*sigh*
http://h1.ripway.com/dojob/C08E01.CPP
there
|


Power Egg
Member Lvl: 10
Egg Points: 12624
Posts: 1928 AIM YIM
|
| Posted: Nov 14, 2006 12:59 p.m. - Subject: |
| |
[quote]void DisplayNums(vector NumberArray, vector TrueFalse) { cout
|


Power Egg
Member Lvl: 10
Egg Points: 12624
Posts: 1928 AIM YIM
|
| Posted: Nov 14, 2006 1:00 p.m. - Subject: |
| |
[quote] void DisplayNums(vector NumberArray, vector TrueFalse)
{ cout
|


Power Egg
Member Lvl: 10
Egg Points: 12624
Posts: 1928 AIM YIM
|
| Posted: Nov 14, 2006 1:01 p.m. - Subject: |
| |
fuck, it did it again
check the part where it says i=25
it should say 24
|


Power Egg
Member Lvl: 10
Egg Points: 11486
Posts: 1132 AIM YIM
|
| Posted: Nov 14, 2006 1:03 p.m. - Subject: |
| |
Anyone know any good C++ tutorial sites? I wanna learn to use it, always been one of my wet-dreams.
|


Power Egg
Member Lvl: 10
Egg Points: 12624
Posts: 1928 AIM YIM
|
| Posted: Nov 14, 2006 1:21 p.m. - Subject: |
| |
not really, i just have books, but check out some online forums, those are usually the best place to look for help
|


Power Egg
Member Lvl: 10
Egg Points: 11486
Posts: 1132 AIM YIM
|
| Posted: Nov 14, 2006 1:45 p.m. - Subject: |
| |
K thanx
|
|
| Posted: Nov 14, 2006 2:00 p.m. - Subject: |
| |
You suck at C++.
|


Power Egg
Member Lvl: 10
Egg Points: 12624
Posts: 1928 AIM YIM
|
| Posted: Nov 14, 2006 2:58 p.m. - Subject: |
| |
if you are refering to me, then yes you’re right, i haven’t used the language in 3 years.
|
|
|