Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

if you got compile error ,you can see the detail info by click the link of the result

Posted by hawk at 2004-12-04 01:32:06 on Problem 2141
In Reply To:Why compile error ? Posted by:cypressx at 2004-12-04 01:05:15
here C++ is vc 6.0
and g++ is g++ 3.4.2
> I can not understand why my sources get compile error , I have written 2 for this task : 
> 
> // 1st one - compile error
> #include <iostream>
> #include <string>
> #include <algorithm>
> #define FOR(i,n) for(int i=0;i<n;i++)
> using namespace std;
> 
> string a,b,tmp,code;
> 
> int main() {
>     cin>>a;
>     b = a;
>     while(cin >> tmp) {
>         code+=tmp;
>         code+=" ";
>     }    
>     cout << code;
>     FOR(i,a.size()) b[i] = toupper(a[i]);
>     for(int i=0;i<code.size();i++) {
>         if(code[i] == ' ') cout << " ";
>         else if(code[i]>='a' && code[i]<='z')cout << a[code[i]-'a'];   
>         else cout << b[code[i]-'A'];
>     }     
>     cout << endl;
>     return 0;
> }
> 
> // 2nd one - compile error
> #include <stdio.h>
> #include <string.h>
> using namespace std;
> char a[26],b[26];
> char c[81];
> 
> int main() {
>     gets(a);
>     gets(c);
>     for(int i=0;i<26;i++) b[i] = a[i] - ('a'-'A');
>     for(int i=0;i<strlen(c);i++) {
>         if(c[i] == ' ') printf(" ");
>         else if(c[i] >= 'a' && c[i] <= 'z') printf("%c",a[c[i]-'a']);
>         else printf("%c",b[c[i]-'A']);
>     }
>     return 0;    
> }    
> 
> I compile them as a "C++"
> So what is the problem :( Please help

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator