-
Notifications
You must be signed in to change notification settings - Fork 0
/
PRINTER.C
54 lines (53 loc) · 1.38 KB
/
PRINTER.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//to calculate the number of characters, lines,blank spaces and vowels in text.
#include<stdio.h>
#include<conio.h>
void main()
{
char c;
int nc=0,nl=1,nw=1,nv=0,d=0;
clrscr();
gotoxy(2,2);
textcolor(LIGHTRED);
cprintf(" terminate the text with CTRL+Z.. hit enter ");
gotoxy(1,5);
while((c=getchar())!=EOF)
{
if(c=='\n')
{
nl++;
nc--;
}
if(toupper(c)=='A' || toupper(c)=='E' || toupper(c)=='I' || toupper(c)=='O' || toupper(c)=='U')
{
nv++;
}
if(c==' ' || c=='\t')
{
nw++;
nc=nc+0;
}
else
nc++;
fprintf(stdprn,"%c",c);
}
textbackground(BLACK);
textcolor(CYAN);
gotoxy(15,20);
cprintf(" the number of characters in the above input are: %d",nc);
fprintf(stdprn,"\n\tthe number of characters in the above input are: %d",nc);
textcolor(RED );
gotoxy(15,21);
cprintf(" the number of lines in the above input are : %d ",nl);
fprintf(stdprn,"\n\t the number of lines in the above input are : %d ",nl);
textcolor(MAGENTA);
gotoxy(15,22);
cprintf(" the number of words in the above input are : %d ",nw);
fprintf(stdprn,"\n\t the number of words in the above input are : %d ",nw);
textcolor(YELLOW);
gotoxy(15,23);
cprintf(" the number of vovels in the above input are : %d ",nv);
fprintf(stdprn,"\n\t the number of vovels in the above input are : %d ",nv);
textcolor(WHITE);
fflush(stdin);
while(!kbhit());
}