www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/14/23:52:06

From: kngaru AT aol DOT com (KNGARU)
Newsgroups: comp.os.msdos.djgpp
Subject: Vector problem
Lines: 27
NNTP-Posting-Host: ladder05.news.aol.com
X-Admin: news AT aol DOT com
Date: 15 Feb 2000 04:01:17 GMT
Organization: AOL http://www.aol.com
Message-ID: <20000214230117.03930.00001183@ng-ce1.aol.com>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 <iostream.h>
#include <vector.h>
#include <stdlib.h>

int main()
{
vector<char> 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<<word<<endl;     //SHOULD OUTPUT THE VECTOR

EXIT_SUCCESS;   //stdlib.h
}

I compile using the gxx command at the dos prompt . . . won't work any other
way, and get a whole lot of iostream errors. there are too many and they are
too long to try and make sense of.  My "hello world"1 programs work with no
problems.  This is just a small test . . . numbers don't work either.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019