749569 2011-03-21 23:00:30 Compile Error 0.000 Minimum 27716 C++ 4873 - Penney Game
i don't understand why my code generate compilation error...
can anybody help me?
my code
Code: Select all
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
int BintoInt(string s){
int k=0;
for(int i=0; i<3; i++){
if(s[i]=='H')
k += (1 << i);
}
return k;
}
int main(){
int n,m;
scanf("%d", &n);
for(int nc=0; nc<n ; nc++){
scanf("%d", &m);
string cad;
cin >> cad;
map < int , int > mapa;
for(int i=0;i<=37; i++){
mapa[BintoInt(cad.substr(i,3))]++;
}
printf("%d",m);
for(int i=0; i<=7; i++){
printf(" %d",mapa[i]);
}
printf("\n");
}
}
the answer :
The compiler couldn't compile your ANSI C/C++ or FreePascal or
GNU Pascal/Java program.
[Notes: - Select C, C++, JAVA, PASCAL or FREEPASCAL in the @JUDGE_ID field,
to ensure that I'll use the proper compiler. Place a 'program...'
sentence in Pascal or FreePascal.
Note that entry point in Java is a 'main' function in a 'Main' class.
- Do not use more than 1024 characters per line, or 40,000 bytes per
program, if you are submitting your programs by E-Mail.
- Do not use '//' comments except in C++ programs [And Note that this
is not Borland C or Turbo Pascal!].
- Some mail tools reformat your text or the standard mail headers.
I compiled the lines I resent you in the "Program Received" message.
(if your mail system adds extra lines to your letter, please include
a "@end_of_source_code" string after the last source code line).
- Please note that your email should be sent as plain text and the
source code should be IN the body, not as an attachment.
Here are the compiler error messages:
00749569_24.c:7: `string' was not declared in this scope
00749569_24.c:7: parse error before `)'
00749569_24.c: In function `int BintoInt(...)':
00749569_24.c:10: `s' undeclared (first use this function)
00749569_24.c:10: (Each undeclared identifier is reported only once
00749569_24.c:10: for each function it appears in.)
00749569_24.c: In function `int main()':
00749569_24.c:20: `string' undeclared (first use this function)
00749569_24.c:20: parse error before `;'
00749569_24.c:21: `cad' undeclared (first use this function)
thanks...