- Get link
- X
- Other Apps
Difference between Comment line and code line -
Here we first discussed about comment line according to C/C++ language so lets start
Comment line -
we use comment for easily explanation any source code we use it for programmer readability and for better understanding these comment are not include in our code or say not counted in our code there are two type of comment -
1. Single line comment : In single line comment we use it for one line comment and the representation of the comment is ' / single line comment/ ' .
Syntax -
// This is Syntax of single line comment
// Here program start
#include<stdio.h>
int main(){
printf("hello world");
}
2. Multiline comment : It is used to comment in multiline code and the representation of the comment is ' /*Multiline comment */ '
Syntax -
/*This is multiline comment and we use it when we explaining something in many line so we use this comment *//*Here is the program syntax*/
#include<stdio.h>
int main(){
printf("hello world");
}
Code line -
The meaning of code line is we use it for instruction our machine and one line of source is may generate one line of instruction for computer which computer understand and given below one example of code are present which add , subtract , multiple and divide for your understanding for code
PROGRAM -
//Adding two number#include <iostream>
using namespace std;
int main()
{
int x, y, z;
cout << "Enter value of x =";
cin >> x;
cout << "Enter value of y =";
cin >> y;
//Addition of two number
cout << "Addition of Two Number"<< "\n";
z = x + y;
cout << z << "\n";
//Subtraction two number
cout << "subtraction of Two Number"<< "\n";
z = x - y;
cout << z << "\n";
//Multiplication two number
cout << "Multiplication of Two Number" << "\n";
z = x * y;
cout << z << "\n";
//Division of two number
cout << "Division of Two Number" << "\n";
z = x / y;
cout << z << "\n";
return 0;
}
Output -
Enter value of x =12
Enter value of y =12
Addition of Two Number
24
subtraction of Two Number
0
Multiplication of Two Number
144
Division of Two Number
1
Code at end of line -
We can create a comment at the end of code line but we have to comment before the line in code.
int main(){
printf("hello world"); // comment after the line
}
Different topic from this topic -
Why coding is important ??
This is a very big question in mind of every first year student why it is important to learn this language reason behind this languages is after learning this student can understand the machine language because computer can understand only machine language and this programming languages convert our in machine languages with the help of coding we make software , website many more thing so you have to think about it
coding is a very important and how to start coding you have to learn many languages like c , c++ , html , css , Javascript ,java, python , kotlin these languages have there particular work like if we learn kotlin then we make mobile application and if we learn html and css then we make website etc these are the benefit of learning programming languages
Comments
Post a Comment