Computer Programming: Write a program to read two initials (letters), e.g X and Y, and display them in the form Hello X.Y. The initials are to be entered from the keyboard in the same line of input. I'm using Dev C++.
Could you give me the codes ?
#include<iostream.h> #include<stdio.h> int main () { It's that part that i require. system("pause"); return 0; }
#include<iostream.h> void main() { char x,y; cout<<"Enter two letters"<<endl; cin>>x>>y; cout<<"Hello"<<x<<"."<<y<<"."; }
Can you please explain the logic behind? I didn't quite understand what you've done in that part. cout<<"Enter two letters"<<endl; cin>>x>>y; cout<<"Hello"<<x<<"."<<y<<".";
What does each of these line means ? cout<<"Enter two letters"<<endl; cin>>x>>y; cout<<"Hello"<<x<<"."<<y<<"."; I'm still a beginner in computer programming. the only codes i'm familiar with is printf,scanf, for . So for endl, cout and cin i've not yet done that.
in first line we give d msg 2 user 4r enterng any 2 letter. in 2nd line dat letter will be store in x and y respectively, in 3rd line 1st hello is msg den print d value store in letter x den 1 dot den 2nd letter y den again dot. and endl is for taking d input in d nxt line after d 1st line msg...
..Okay..!! :) ..!! Is it possible to write it using scanf and printf ?
I've got it Thank You..!! :)
no... scanf and printf are in stdio library funcion but here in c++ we r using iostream library functn..
Join our real-time social learning platform and learn together with your friends!