C++ Program to Print Smiling Face on Screen

To print smiling face on the screen in C++ programming, first you have to ask from user to enter the number of smiling face, he/she wants to print, to print the required number of smiling face on the screen.

Use the ASCII value of smiling face, which is 1, first declare a variable say sml of int type and initialize 1 to it. Now declare a variable say ch of type char and initialize sml to ch. Now ch holds the smiling face character. In this way the program should be created.

void main()
   int sml=1, i, limit;
   char ch=sml;
   cout<<"How many smiley face you want to print ? ";
   for(i=0; i<limit; i++)
      cout<<ch<<" ";

When the above C++ program is compiled and executed, it will produce the following result:

C++ program print smiling face

C++ Online Test

« Previous Program Next Program »

Follow/Like Us on Facebook

Subscribe Us on YouTube