I'm new to c++ so the solution may be obvious, but I'm attempting to cast ASCII numbers to their corresponding letters of the alphabet using a sentinel controlled loop. The compiler gives me the error "Invalid operands to binary expression ('std::__1::ostream' (aka 'basic_ostream') and 'vector')" next to cout. I'm using XCode. Any help would be much appreciated.
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
int num;
char intermediary;
vector<char> Letters;
cin>>num;
while (num!= -1){
intermediary=char(num);
Letters.push_back(intermediary);
cin>>num;
}
cout<<Letters<<endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire