Chapter - 10: Strings

Write a program to delete all vowels from a sentence. Assume that the sentence is not more than 80 characters long.


F
Sections
7
Exercises

A

B

C

D

E

F

1

2

3

4

5

6

7

8

9

10

11

12

#include<stdio.h>
#include<conio.h>
#include<Windows.h>
#define Vowel line[i] == 'A' || line[i] == 'a' || line[i] == 'E' || line[i] == 'e' \
 || line[i] == 'I' || line[i] == 'i' || line[i] == 'O' || line[i] == 'o' || \
 line[i] == 'U' || line[i] == 'u'
 
void del_vow(char *line)
{
	int i, j;
	for (i = 0; line[i] != '\0'; i++)
		if (Vowel)
		{
		    for (j = i; line[j] != '\0'; j++)
				line[j] = line[j + 1];
			i--;
		}

}
int main()
{
	char line[80];
	puts("Enter the line");
	gets_s(line);
	del_vow(line);
	printf("\nLine without vowels\n");
	puts(line);
	getch();
	return 0;
}

© 2020 Garbage Valuegarbage value logo