Untitled

 avatar
unknown
plain_text
a year ago
595 B
4
Indexable
#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;
void no_space ( char str1 []);
int main()
{    
	char str1 [] =" good luck in your finals";
	int i;
	for (i=0; str1[i]; i++){}//size
	cout<<"Size "<<i <<endl;
	cout<<str1<<endl;
	no_space(str1);
	for (i=0; str1[i]; i++){}//size
	cout<<"Size "<<i <<endl;
	cout<<str1<<endl;
    getchar();
    return 0;
}


void no_space ( char str1 [])
{
	
	int i, newsize=0;
	for (i=0; str1[i]; i++){

		if (str1[i]!=' '){
			str1[newsize]=str1[i];
			newsize++;
		}

	}
	str1[newsize]='\0';




}
Editor is loading...
Leave a Comment