0

I want to remove the - caracter from my sentence! there is my code:

#include <iostream>
#include <cstring>

using namespace std;

int main() {
    char a[101];
    cin.getline(a,101);
   for(int i=0;i<=strlen(a)-1;i++){
       if(a[i]=='-'){
           a[i]=' ';
       }
   }
   cout<<a;
}

And i run this: i had -34 ms I need this answer: i had 34 ms but i get this: i had 34 ms a space in plus!

0 Answers0