- 2
How to code in code coach?
I did a code for extraterrestrial problem in code coach... Cud run it n get correct output in computer... But all 5 test cases are shown as failed in code coach result section...y is it so...?
5 Answers
+ 2
Shilpa
It would be great to include the code in discussion, so that somebody can help fix its bugs.
0
As already told, Copy code to playground, save and share link here.. So that it helps to see the mistakes..
0
Ok
#include <iostream>
using namespace std;
int main() {
string myString;
cout<<"Enter an English word: ";
cin>>myString;
int size = myString.length();
char *cStr = new char [size];
for(int x=0, y=size-1; x<size; x++,y--)
{
cStr[y] = myString.at(x);
}
cout<<endl;
for(int x =0; x<size; x++)
{
cout<<cStr[x];
}
delete [] cStr;
return 0;
}
0
Code coach need only the output..
As it checks only the output by program.. So the statement cout<<"Enter an English word:" ; is not needed. Remove it then it works..
0
Thank you so much... It did work ..