#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
string str1;
char* str;
cout<<" enter your command "<<endl;
cin>>str1;
str=(char*)str1.c_str();
char* str2="exit";
int status;
while(strcmp(str,str2)!=0){
// createChildProcess(str);
cout<<str<<endl;
cout<<str1<<endl;
cout<<strlen(str)<<endl;
cout<<" enter your command "<<endl;
cin>>str;
}
return 0;
}
try to run this program and tell me why the output is it?
as i tried to enter
good day
and the output becomes
good
good
4
enter your command
1
1od
1
but i supposed the output will
good 1
good 1
6
enter your command
i just want to know how the program run.