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

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

 C++ Output (Print Text) The cout object, together with the << operator, is used to output values/print text: for example ; #include <iostream> using namespace std; int main() {   cout << "Hello World!";   return 0; } Note: You can add as many cout objects as you want. However, note that it does not insert a new line at the end of the output: #include <iostream> using namespace std; int main() {   cout << "Hello World!";   cout << "I am learning C++";   return 0; }

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 FM Radio Circuit with simple circuit

 FM Radio circuit is the simple circuit that can be tuned to the required frequency locally. This article describes the circuit of FM radio circuit. This is a pocket sized radio circuit. FM Radio Circuit Principle: Radio is the reception of electromagnetic wave through air. The main principle of this circuit is to tune the circuit to the nearest frequency using the tank circuit. Data to be transmitted is frequency modulated at the transmission and is demodulated at the receiver side. Modulation is nothing but changing the property of the message signal with the respect to the carrier frequency. Frequency range of FM signal is 87.5MHz to 108.0MHz. The output can be heard using  speaker. Circuit Components: LM 386 IC. BF 494 transistor  T1, T2. Variable resistor. Variable capacitor. Inductor coil. FM Radio Circuit Design: The LM386 IC is used extensively in the FM Radio circuit. This is a low-voltage power amplifier for audio. It has a total of eight pins. It requires a sup...