really2 need help!!!!

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
zero_cool
New poster
Posts: 27
Joined: Fri Sep 02, 2005 6:33 am

really2 need help!!!!

Post by zero_cool » Fri Sep 02, 2005 6:38 am

I dunno what's wrong with my c++ code, but it says compile error.

Here is my code.

//////////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <cmath>

using namespace std;

void main(){
string st;
char tChar; //temporary char
int i,
ascii;

cin.ignore(200,'\n');
cin.get(tChar);
while (tChar!='_'){
ascii=0;
for (i=7;i>2;i--){
cin.get(tChar);
if (tChar=='o') {
ascii+=pow(2,i);
}
}
cin.get();
for (i=2;i>-1;i--) {
cin.get(tChar);
if (tChar=='o') {
ascii+=pow(2,i);
}
}
cout << char(ascii);
cin.ignore(200,'\n');
cin.get(tChar);
}
}
//////////////////////////////////////////////////////////////////////////////////
Well, It's my first time to submit c++ code. I usually use pascal.

User avatar
Cho
A great helper
Posts: 274
Joined: Wed Oct 20, 2004 11:51 pm
Location: Hong Kong

Post by Cho » Fri Sep 02, 2005 7:34 am

You should include <string>.

zero_cool
New poster
Posts: 27
Joined: Fri Sep 02, 2005 6:33 am

Post by zero_cool » Sat Sep 03, 2005 6:01 am

thank you. I got ac.

Post Reply

Return to “C++”