Write a C++ program that accepts a string and deletes the last character by moving the null character one position the left.
#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++