Answer to Question #25039 in C++ for hanrik

Question #25039
Write a C++ program that accepts a string and deletes the last character by moving the null character one position the left.
1
Expert's answer
2013-02-26T09:28:21-0500
#include<iostream>
#include <string>

using namespace std;

int main() {
string s;
cin >> s;
for (int i=s.size(); i>0; i--)
s[i]=s[i-1];
cout << s;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS