Well, you say strings but you are using arrays and not strings?
Here it is for strings:
Code:
#include<iostream>
#include <string>
using namespace std;
int main()
{
string original_string = "Hello 123456";
string up_to_space;
int location;
location = original_string.find(' ',0);
up_to_space = original_string.substr(0,location);
cout << up_to_space;
system("pause");
return 0;
}
But for the cstring...or arrays.
Code:
final_string[index] = original_String[index];
In your last for loop upto the appropiate value of where index would be where the space occurs.