cpp-category

C++ basic programs

C++ Basic Programs

C++ basic programs are a set of instructions that tells a computer what to do is called program. A computer works according to the given instructions in the program. Computer programs are written in programming languages. A person who develops s program is called a programmer.

Advantage of Computer Program

Different advantages of a computer program are followed

  • A computer program can solve many problems by giving instructions to the computer.
  • A computer program can be used to perform a task repeatedly and quickly.
  • A program can process a large amount of data easily.
  • It can display the results in different styles.
  • The processing of a program is more efficient and less time-consuming.
  • Different types of programs are used in different fields to perform certain tasks.

Write C++ first program

Let us look at a simple code that would print the words Hello zoetropefilm.

#include <iostream>
#include <conio.h>
using namespace std;
int main() 
{
   cout << "Hello zoetropefilm"; // prints Hello zoetropefilm
   return 0;
}

 

Let us look at the various parts of the above program:

# Preprocessing
include Includes another source file into current source file at the line immediately
io-steam In the c++ language io-stream is a header file. This header file defines how input and output stream.
conio.h In this c++ language conio.h is also header files.
namespace std; The line using namespace std; tells the compiler to use the std namespace. Namespaces are a relatively recent addition to C++.
int main() The line int main() is the main function where program execution begins.
cout<< causes the message “Hello zoetropefilm” to be displayed on the screen.
return 0; terminates main( )function and causes it to return the value 0 to the calling process

 

Prachi

NCERT-NOTES Class 6 to 12.

Related Articles

Check Also
Close
Back to top button