Newsgroups: comp.os.msdos.djgpp From: manni DOT heumann AT gmx DOT de (Manni Heumann) Subject: Re: Vector problem References: <20000214230117 DOT 03930 DOT 00001183 AT ng-ce1 DOT aol DOT com> X-Newsreader: News Xpress 2.01 Date: Tue, 15 Feb 2000 10:50:52 GMT NNTP-Posting-Host: dhcp33-226.uni-bielefeld.de Message-ID: <38a92f95$1_1@news.uni-bielefeld.de> X-Trace: 15 Feb 2000 11:51:01 +0200, dhcp33-226.uni-bielefeld.de Lines: 45 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <20000214230117 DOT 03930 DOT 00001183 AT ng-ce1 DOT aol DOT com>, kngaru AT aol DOT com (KNGARU) wrote: >sort of . . . >This doesn't work, granted there may be some problems to it, but I keep getting >errors I have no clue what to do with. >Here's the program: >#include >#include >#include For a start, change iostream.h to iostream and vector.h to vector (drop the h). > >int main() >{ >vector word(10); //ten letter word >int k; //counter >char letter; //no need >while(cin>>letter) //input letter by letter . . . one step at a time >{ >word[k]=letter; //puts the letter in the current index of the vector >k++; //increases counter >} >cout< >EXIT_SUCCESS; //stdlib.h >} You are trying to use a vector as a string. This might be a good way to learn to use vectors, but string is already there. I guess the errors you are getting are about the operator ostream< being undefined. This is correct. If you want to output a vector, you will have to provide your own operator, because the compiler simply does not know how to output a vector. Maybe you should wait with this and take one step after the other. What you can do, is output the vector bit by bit, like so: for (int i=0; i