(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!

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; }

c++

5/15/2022 3:51:53 PM

learner

15 Answers

New Answer

+3

You are not included iostream header which is needed for cout, cin to exist. use small s in string. Also in size()

+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; }

+1

Jayakrishna🇮🇳 i have found that mistake got alot better but still no out put

+1

Jayakrishna🇮🇳 never mind i got it

+1

not taking input in this update code!!

+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; }

+1

Seems fine now.. 👍

+1

ty Jayakrishna🇮🇳 also congrats for me for figuring my mistakes to some point 😂

+1

🙂 congrats now you are real *learner

+1

Jayakrishna🇮🇳 when s is capitalized the word turns blue what does that mean does Strings ,Size have other use

+1

It means those are may be class names. It is a guideline use class names as Title like first letter capital.

+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..

0

then why does int turn blue Jayakrishna🇮🇳

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

0

Я хвдц ты гсл 👍