PDA

View Full Version : How To Take Input From Keyboard In C++


Morash
04-06-2014, 12:00 PM
A Simple Program Used For Taking Input From The Keyboard/User.








A Program Used For Taking Input From The Keyboard/User. I Have Declared Two Variables char And int Type Which Store The Value Entered By The User And Display It On Screen. For Input We Use cin>>variable_name; And For Output We Use cout<<"Output Message ";

char a[20]; Is Character Type Variable Which Stores 20 Characters

int b; Is Integer Type Variable Which Stores A Number

endl Is Used For End Of Line

\n Is Used For New Line



http://i60.tinypic.com/vo0j1v.jpg



Output
http://i57.tinypic.com/vy5tl3.jpg

PRINCE SHAAN
04-06-2014, 12:18 PM
Thanks for nice sharing........................

Morash
04-06-2014, 07:33 PM
Shukriya ..

pakeeza
04-06-2014, 09:04 PM
Gooood Job

AYAZ
04-06-2014, 10:35 PM
Thanks for sharing morash. I tried it and it worked ;).

AYAZ
04-06-2014, 10:48 PM
Morash ek cheez hum nie yeh kyon use kara

cout << "Your name is "<<a<<endl;

yeh cout mei <<a<< kyon use kara hie?

Morash
04-07-2014, 02:02 AM
Morash ek cheez hum nie yeh kyon use kara

cout << "Your name is "<<a<<endl;

yeh cout mei <<a<< kyon use kara hie?

<<a Es Liye Use Huwa Hai K Jo Value Hum Type Karte Hai, Wo a Mai Store Ho Jate Hai ..
Phir Os Value Ko Hum Display Karne K Liye Dosre Cout Statement K Saath Call Karte Hai ..

Like, Agar Hum Ye Use Na Karte To Phir Wo Second Cout Message Es Tarah Show Hota;
The Number You Entered Is: Aur Agy Wo Number Display Nai Hota ..

a Ko Remove Kar K Phir Program Ko Run Karo To Pata Lag Jaega Kis Liye Use Hota Hai =p

Copyright ©2008
Powered by vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.