Answer to Question #25039 in C++ for hanrik
Write a C++ program that accepts a string and deletes the last character by moving the null character one position the left.
1
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment