Please can anybody tell me why nothing is printed
Here is my code.
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <algorithm>
using namespace std;
int main()
{
string s,rt;
cin >> s;
long long int i,t = s.size();int c=0,sum=0;
for ( i = 0; i < t; i++ ) {
sum = (c+s[i]-'0')/2;
rt[i] = sum+'0';
c = (c+s[i]-'0')%2;
if ( c == 1 ) {
c = (c*10);
}
sum = 0;
}
cout << rt;
system("pause");
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.