Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Monday, 25 April 2016

This Program will show how to find a factorial of any number using Function


Program # 5 : Factorial using Function :




#include <iostream>

using namespace std;

int factFinder(int x){
   if(x==0){
    return 1;
   }else{
     return x*factFinder(x-1);
   }

}


int main()
{
  cout << factFinder(5) << endl;
}


Note : You can use any integer number in the  code. I just use 5 .


Output of the Program :




This Program will show you how to find a sum of Different Numbers using Arrays in C++ Language


Program # 4 : Find the Sum using an Array 


#include <iostream>

using namespace std;

int main()
{
    int avg[] = {6,14,100,40,40};
     int sum = 0;
    for(int x=0; x<5; x++){
        sum += avg[x];
        cout << sum << endl;
    }


}

Note : you can use any Numbers to find their Sun.

Output of the Program : 


This program will show you to how to make simple Calculator using if/else statement in C++ Language.


Program # 3 : Calculator using if/else statement


#include <iostream>

using namespace std;

int main()
{
    float a, b;
    char c;
    float R;
    cout << "Enter the First Number : \n";
    cin >> a;
    cout << "Enter the Second Number : \n";
    cin >> b;
    cout << "*****What to do?***** \n" << "+ For Addition \n" << "- For Subtraction \n" << "* For Multiplication \n" << "/ For Division \n " ;
    cin >> c;
    if(c=='+' )
        {
        R = a + b;
        cout << R;
        }
        else if(c=='-')
        {
            R = a - b;
            cout << R;
        }
        else if (c=='*')
        {
            R = a * b;
            cout << R;

        }
        else if(c=='/')
        {
            R = a / b ;
            cout << R;

        }
        else
            cout << "Invalid operator ";



    return 0;
}


Output Of the Program :




Watch This Video 




This code will Print Table of any Number(including decimal number) using C++ Language 



Program # 2 : Printing a table of any Number ( Including decimal numbers)



#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{

   float a,i;
   do{
   cout << " Which Table do you want to Print or 0 to Quit? \n";
   cin >> a;

   for(i=1; i<=10; i++)
   cout << a << " * " << i << " = " <<  a * i  << endl;
   }while(a='0');
    return 0;
}

Output of the program : 



This Program will show you how to Find a Factorial of any Number using C++ Language



Program # 1 : How to find a Factorial of a Number :


#include <iostream>

using namespace std;

int main()
{

  int a, num, fact = 1;
  cout << "Enter the Number To Find Its Factorial: \n";
  cin >> num;
  for(a=1; a<=num; a++)
    fact = fact*a;
  cout << "The Factorial of Number is: \n" << fact << endl;
    return 0;
}

Output of the Program : 



Wednesday, 20 April 2016

Introduction to C++ Language




C++ (pronounced as "cee plus plus",) is a general-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation.

It was designed with a bias toward system programming and embedded, resource-constrained and large systems, with performance, efficiency and flexibility of use as its design highlights. C++ has also been found useful in many other contexts, with key strengths being software infrastructure and resource-constrained applications including desktop applications, servers (e.g. e-commerce, web search or SQL servers), and performance-critical applications (e.g. telephone switches or space probes). C++ is acompiled language, with implementations of it available on many platforms and provided by various organizations, including the FSF, LLVM, Microsoft, Intel and IBM.

C++ is standardized by the International Organization for Standardization (ISO), with the latest (and current) standard version ratified and published by ISO in December 2014 asISO/IEC 14882:2014 (informally known as C++14).The C++ programming language was initially standardized in 1998 as ISO/IEC 14882:1998, which was then amended by theC++03, ISO/IEC 14882:2003, standard. The current C++14 standard supersedes these andC++11, with new features and an enlarged standard library. Before the initial standardization in 1998, C++ was developed by Bjarne Stroustrup at Bell Labs since 1979, as an extension of the C language as he wanted an efficient and flexible language similar to C, which also provided high-level features for program organization.

Many other programming languages have been influenced by C++, including C#, Java, and newer versions of C (after 1998).