ログイン
新規登録
AtsuoCoder Petrozavodsk Contest 001
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 36193a2e-246f-40c6-b176-400b096888dc
コード
#include <bits/stdc++.h> using namespace std; int main() { string S; cin >> S; for(int i=0; i<S.size() i++){ if(S.at(i)=="a"){ S.at(i)="p" } else if(S.at(i)=="c"){ S.at(i)="a" } else if(S.at(i)=="p"){ S.at(i)="a" } } cout<<S<<"MAN"<<endl;
結果
問題
点数
言語
結果
実行時間
メモリ
D - PACMAN
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'int main()': Main.cpp:6:27: error: expected ';' before 'i' 6 | for(int i=0; i<S.size() i++){ | ^~ | ; Main.cpp:7:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 7 | if(S.at(i)=="a"){ | ~~~~~~~^~~~~ Main.cpp:8:17: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 8 | S.at(i)="p" | ^~~ | | | const char* Main.cpp:8:20: error: expected ';' before '}' token 8 | S.at(i)="p" | ^ | ; 9 | } | ~ Main.cpp:10:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 10 | else if(S.at(i)=="c"){ | ~~~~~~~^~~~~ Main.cpp:11:17: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 11 | S.at(i)="a" | ^~~ | | | const char* Main.cpp:11:20: error: expected ';' before '}' token 11 | S.at(i)="a" | ^ | ; 12 | } | ~ Main.cpp:13:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 13 | else if(S.at(i)=="p"){ | ~~~~~~~^~~~~ Main.cpp:14:17: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive] 14 | S.at(i)="a" | ^~~ | | | const char* Main.cpp:14:20: error: expected ';' before '}' token 14 | S.at(i)="a" | ^ | ; 15 | } | ~ Main.cpp:17:25: error: expected '}' at end of input 17 | cout<<S<<"MAN"<<endl; | ^ Main.cpp:3:12: note: to match this '{' 3 | int main() { | ^