Plz help out how to store negative integer value as a chracter
No u can not save negative value in a string
#include
#include
using namespace std;
int main() {
char str[1000];
int nstr[2000];
cin>>str;
int i=1;
cout<<str[0];
while(str[i]!=’\0’){
nstr[i]=int(str[i])-int(str[i-1]);
cout<<nstr[i]<<str[i];
i++;
}
return 0;
}
This is the way in which you will be able to solve the ques and get all the test cases passed