0

Need Help!

#include <iostream> using namespace std; int main() { string a,z; cin>>a; int p= a.length(); for(int y=p-1 ;y==0;y--){ for(int i=0;i<p;i++){ z[i]=a[y]; } } cout<<z; return 0; } Why is this code giving no output?

13th May 2020, 8:21 AM
Nazeefa Labiba
Nazeefa Labiba - avatar
3 ответов
+ 1
First mistake is putting y==0 which won't run the loop
13th May 2020, 8:33 AM
Abhay
Abhay - avatar
+ 2
It should be char z[20] instead of string z;
13th May 2020, 8:54 AM
Abhay
Abhay - avatar
0
ya i changed that but its still not working
13th May 2020, 8:36 AM
Nazeefa Labiba
Nazeefa Labiba - avatar