Simple C++ output exercises: cout, <<, endl and \n

Now that we've learned how to display simple C ++ outputs using the cout command, let's practice a little more.
I want to see you trying, until you can, solve the exercises below.
Exercises in C++ solved and commented codes

C++ Exercises

1. Phrase on screen - Create a program that displays the phrase "The first program we never forget!"

2. Etiquette - Design a program that writes your full name on the first line, your address on the second, and zip code and phone number on the third, using endl.

3. Repeat the previous program, now using \ n instead of endl. Can you do everything in one cout command only? Try it.

4. Lyrics - Make a program that displays on the screen a lyrics you like (forbidden Justin Bieber lyrics).

5. Message - Write a message to a person you like. Implement a program that prints this message, prints it out, and sends it to this person. Say it was a virus that a hacker installed on your computer.

6. To the site - Make a program that shows on screen what you want to do using your C ++ skills.

7. Square - Write a program that shows the following figure:

XXXXX
X         X
X         X
X         X
XXXXX

8. Gradebook - You were hired by a school to do the student report card system. As a first step, write a script that produces the following output:

STUDENT NOTE
========= =====
ALINE          9.0
Mário            TEN
SERGIO       4.5
SHIRLEY     7.0

9. Large Letter - Write a script to produce the progressive C++ letter C on the screen. If it was ‘L’, it would be like this:
L
L
L
LLLLL

10. Menu - Write a script that shows the following menu on the screen:

Customer base
0 - End
1 - Includes
2 - Alter
3 - Excludes
4 - Consultation
Option:


11. Pine - Implement a program that draws a "pine" on the screen, similar to the one below.

Enrich the design with other characters by simulating embellishments.

       X
      XXX
     XXXXX
    XXXXXXX
   XXXXXXXXX
  XXXXXXXXXXX
 XXXXXXXXXXXXX
XXXXXXXXXXXXXXX
       XX
       XX
      XXXX
Write your solutions in the comments!

1 comment:

  1. Thank you for sharing an amazing & wonderful blog. This content is very useful, informative and valuable in order to enhance knowledge. Keep sharing this type of content with us & keep updating us with new blogs. Apart from this, if anyone who wants to join the C++ Training institute in Delhi, can contact 9311002620 or visit our website-
    C++ training institute in Delhi

    ReplyDelete