#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
char arr[500];
int ch, count = 0;
while(ch != 13)
{
ch = arr[count] = getche();
if(ch == 32)
{
arr[count] = '-'; //space is replaced by -
}
count++;
}
cout << endl;
for(int i = 0; i<= count-1; i++)
{
cout << arr[i];
}
cout << endl;
system("pause");
}
#include <conio.h>
using namespace std;
int main()
{
char arr[500];
int ch, count = 0;
while(ch != 13)
{
ch = arr[count] = getche();
if(ch == 32)
{
arr[count] = '-'; //space is replaced by -
}
count++;
}
cout << endl;
for(int i = 0; i<= count-1; i++)
{
cout << arr[i];
}
cout << endl;
system("pause");
}