8escs01 problem solving through programming unit-2: c programming basics


MANAGING INPUT & OUTPUT OPERATIONS



Download 0,98 Mb.
bet16/22
Sana19.05.2023
Hajmi0,98 Mb.
#940862
1   ...   12   13   14   15   16   17   18   19   ...   22
Bog'liq
Module 2 c program

MANAGING INPUT & OUTPUT OPERATIONS


69
void main( )
{ char ch ;
printf ( "\n Press any key to continue:" ) ; getch( ) ; /* will not echo the character */ printf ( "\n Type any character" ) ;
ch = getche( ) ; /* will echo the character typed */ printf ( "\n Type any character" ) ;
getchar( ) ; /* will echo character, must be followed by enter key */
}
UNFORMATTED INPUT FUNCTIONS
(c) getche( ) function:
  • getche( ) also accepts only single character, but unlike getch( ), getche( ) displays the entered character in the screen.
  • Syntax: variable_name = getche( );

  • Example for getch( ), getche( ), getchar( ):

Output:
Press any key to continue: Type any character B
Type any character W W

MANAGING INPUT & OUTPUT OPERATIONS


70
UNFORMATTED INPUT FUNCTIONS
(d) gets( ) function:
  • It accepts any line of string including spaces from the standard Input device (keyboard).
  • It stops reading character from keyboard only when the enter key is pressed.
  • Syntax: gets(variable_name);
  • Example: char ch[20];

  • gets(ch);

MANAGING INPUT & OUTPUT OPERATIONS

  • Example: char z[20] = “welcome”;

  • putchar(z);

71
UNFORMATTED OUTPUT FUNCTIONS
(a) putch( ) function:
  • putch displays any alphanumeric characters to the standard output device.
  • It displays only one character at a time.
  • Syntax: putch(variable_name);
  • Example: char z[20] = “welcome”;

  • putch(z);
    (b) putchar( ) function:
  • putchar displays one character at a time to the Monitor.
  • Syntax: putchar(variable_name);

Download 0,98 Mb.

Do'stlaringiz bilan baham:
1   ...   12   13   14   15   16   17   18   19   ...   22




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish