1. C++Basics

Next Blog (2. cpp) >>

Introduction :
    *
C++ is a cross platform programming language
    * Gives programmers a high level control over system resources and memory
     

HandWrittenCode >> compiler >> binary/meachineCode >> cpuRunsTheCode


Building and Running first code :
    
#include<iostream>
    using namespace std;
    int main(){
        cout<< "Hello World"; // display the content in standard output
        /*code*/
        return 0; // signifies successful execution of code to compiler
    }

    compilation occure from top to bottom .
    compilation through command line
    g++ filename.cpp               // defaut name of compiled file is a.out
    running a file
    ./a.out
   
    g++ -o programmName filename.cpp
    ./programmName  


Input and output
   
By command Line::
    ./a.out
    input value  || goes to cin>> x;
    output value|| goes to cout<<x;
   
    By using Files :
  say we have two file s
        1. input.txt
        2. output.txt

    int main(){
        int x,y;
        freopen("input.txt" , "r", stdin);
        freopen("output.txt" , "r" ,stdout);
        
        /* Input Output code */
        return 0;
    }

Next Blog (2. cpp) >>

Comments

Popular posts from this blog