(ANSWERED)i tried to do the extra terrestrails code but i got it wrong can someone check my code . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

(ANSWERED)i tried to do the extra terrestrails code but i got it wrong can someone check my code .

#include <string> using namespace std; int main() { String s; String s1; cin>> s; for (int i =s.size()-1;i>=0;--i){s1+=s[i];} cout<<s1; return 0; }

15th May 2022, 3:51 PM
learner
learner - avatar
15 Answers
+ 3
You are not included iostream header which is needed for cout, cin to exist. use small s in string. Also in size()
15th May 2022, 4:30 PM
Jayakrishna 🇮🇳
+ 1
#include <iostream> #include <string> using namespace std; int main() { string s; string s_new; for (int i =s.size()-1;i>=0;--i){ s_new+=s[i]; } cout<<s_new; return 0; }
15th May 2022, 4:30 PM
learner
learner - avatar
+ 1
Jayakrishna🇮🇳 i have found that mistake got alot better but still no out put
15th May 2022, 4:31 PM
learner
learner - avatar
+ 1
Jayakrishna🇮🇳 never mind i got it
15th May 2022, 4:33 PM
learner
learner - avatar
+ 1
not taking input in this update code!!
15th May 2022, 4:33 PM
Jayakrishna 🇮🇳
+ 1
#include <iostream> #include <string> using namespace std; int main() { string s; string s_new; cin>>s; for (int i =s.size()-1;i>=0;--i){ s_new+=s[i]; } cout<<s_new; return 0; }
15th May 2022, 4:33 PM
learner
learner - avatar
+ 1
Seems fine now.. 👍
15th May 2022, 4:34 PM
Jayakrishna 🇮🇳
+ 1
ty Jayakrishna🇮🇳 also congrats for me for figuring my mistakes to some point 😂
15th May 2022, 4:35 PM
learner
learner - avatar
+ 1
🙂 congrats now you are real *learner
15th May 2022, 4:36 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 when s is capitalized the word turns blue what does that mean does Strings ,Size have other use
15th May 2022, 4:38 PM
learner
learner - avatar
+ 1
It means those are may be class names. It is a guideline use class names as Title like first letter capital.
15th May 2022, 4:41 PM
Jayakrishna 🇮🇳
+ 1
learner It's depends on compiler implementation. Generally keywords are rendered in red and Class or special purpose literals are rendered as blue. Not sure why int and float are blue rendered, instead light red color. check it in java compiler, it's in red, not blue..
16th May 2022, 2:48 PM
Jayakrishna 🇮🇳
0
then why does int turn blue Jayakrishna🇮🇳
15th May 2022, 4:42 PM
learner
learner - avatar
0
#include<iostream> #include <string> using namespace std; int main() { string s; string s1; cin>> s; for (int i =s.size()-1;i>=0;--i){s1+=s[i];} cout<<s1; return 0; } // I am solve your problem
16th May 2022, 5:29 AM
M.A GAMING
0
Я хвдц ты гсл 👍
16th May 2022, 4:16 PM
Barış Gürgen