Skip to main content

Who Else Wants To Know The Mystery Behind C++ comments?

 C++ Comments



C++ Comments

Comments can be used to explain C++ code, and to make it more readable. It can also be used to prevent execution when testing alternative code. Comments can be singled-lined or multi-lined.


Single-line Comments

Single-line comments start with two forward slashes (//).


Any text between // and the end of the line is ignored by the compiler (will not be executed).


This example uses a single-line comment before a line of code:


Example

// This is a comment

cout << "Hello World!";






This example uses a single-line comment at the end of a line of code:


Example

cout << "Hello World!"; // This is a comment

C++ Multi-line Comments

Multi-line comments start with /* and ends with */.


Any text between /* and */ will be ignored by the compiler:


Example

/* The code below will print the words Hello World!

to the screen, and it is amazing */

cout << "Hello World!";





Single or multi-line comments?






It is up to you which you want to use. Normally, we use // for short comments, and /* */ for longer.


Comments

Popular posts from this blog

The Secret of Successful TOP MOBILE BRANDS #bbk electronics

Everything you should know about BBK Electronics, its founder, brands & products, and net worth. The name BBK Electronics might not sound common to many out there, but, if you’ve used an Oppo, Vivo, OnePlus, Realme, or iQOO smartphone before, then you’ve used a BBK Electronics product. What is BBK Electronics? BBK Electronics. It markets smartphones under the Realme, OPPO, Vivo and OnePlus brands, and Blu-ray players, headphones and headphone amplifiers under the OPPO Digital division. BBK Electronics: Meet the world’s 2nd largest smartphone manufacturer you’ve probably never heard. Apple and Samsung are undeniably the most popular smartphone brands today. Shipping almost 300 million units last 2019, Samsung easily beats the pack to become the world’s largest phone manufacturer. All of this is expected because everybody’s heard about Samsung, and everybody either owns a Samsung phone or knows somebody who does. But what do you know about BBK Electronics, the world’s second-largest ...

How to make 12V 1A SMPS Power Supply Circuit Design

Every Electronic device or product requires a reliable power supply unit (PSU)operate it. Almost all devices in our home, like TV, Printer, Music Player,etc. consists of a power supply unit built into it which converts the AC mains voltage to a suitable level of DC voltage for them to operate. The most commonly used type of power supply circuit is the SMPS (Switching Mode Power Supply), you can easily find this type of circuits in your 12V adapter or Mobile/Laptop charger. In this tutorial, we will learn how to build a 12v SMPS circuit that would convert AC mains power to 12V DC with a maximum current rating of 1.25A. This circuit can be used to power small loads or even be adapted into a charger to charge you lead-acid and lithium batteries. If this 12v 15watt power supply circuit doesn’t match your requirement, you can check various power supply circuit with different ratings. Before proceeding with any kind of power supply design, requirement analysis has to be done based on the...

In 10 Minutes, I'll Give You The Truth About PUBGY

 PUBG: Battlegrounds (previously known as PlayerUnknown's Battlegrounds) is a battle royale game developed by PUBG Studios and published by Krafton. The game, which was inspired by the Japanese film Battle Royale (2000), is based on previous mods created by Brendan "PlayerUnknown" Greene for other games, and expanded into a standalone game under Greene's creative direction. It is the first game in the PUBG Universe series. The game is played from either a third-person or first-person perspective. In the game, up to one hundred players parachute onto an island where they scavenge for weapons and equipment to kill other players while avoiding getting killed themselves. The available safe area of the game's map decreases in size over time, directing surviving players into an ever tightening space to force encounters. The last surviving player (or team) wins the round. Bad side of Pubgy: Most gamers spend their entire day playing PUBG which means they end up becoming ...