-moz-user-select:none; -webkit-user-select:none; -khtml-user-select:none; -ms-user-select:none; user-select:none;

Wednesday 22 July 2015

Convertion of marlas into square feet

My aim is to implement C++ in our daily lives and for this purpose,today I am here with a very easy but interesting example of "switch" statement.This program will convert marlas being enterd by the user into square feet and square feet being enterd by the user into marlas.I have also used the concept of "goto" statement in this program.

Below is the source code of this program.

Source code


#include<iostream>
#include<conio.h>
using namespace std;
main()
{
int choice;
float marlas,squarefeet;
x: //label
cout<<"\t"<<"\t"<<"MAIN MENU"<<"\t"<<"\t"<<endl<<endl;
cout<<"Press 1 for converting marlas into square feet."<<endl<<endl;
cout<<"Press 2 for converting square feet into marlas."<<endl<<endl;
cout<<"Enter your choice:";
cin>>choice;
cout<<endl;
switch(choice)
{
case 1:
cout<<"Enter the required marlas:";
cin>>marlas;
cout<<endl;
squarefeet=marlas*5399.21;
cout<<"The required square feet="<<squarefeet<<endl<<endl;
break;
case 2:
cout<<"Enter the required square feets:";
cin>>squarefeet;
cout<<endl;
marlas=squarefeet*0.0001;
cout<<"The required marlas="<<marlas<<endl<<endl;
break;
default:
cout<<"Invalid choice."<<endl;
}
goto x;
}

Output

convertion of marlas into square units

Explanation

As we know that the formula for converting marlas into square feet is as follows:

squarefeet=marlas*5399.21;

The formula for converting square feet into marlas is as follows:

marlas=squarefeet*0.0001;

The "goto" statement used in the program will repeat the menu again and again.

Friday 17 July 2015

Turbo C++ for Windows

Introduction

Turbo C++ was a C++ compiler and integrated development environment and computer language originally from Borland. Most recently it was distributed by Embarcadero Technologies, which acquired all of Borland's compiler tools with the purchase of itsCodeGear division in 2008. The original Turbo C++ product line was put on hold after 1994 and was revived in 2006 as an introductory-level IDE, essentially a stripped-down version of their flagship C++Builder. Turbo C++ 2006 was released on September 5, 2006 and was available in 'Explorer' and 'Professional' editions. The Explorer edition was free to download and distribute while the Professional edition was a commercial product. In October 2009 Embarcadero Technologies discontinued support of its 2006 C++ editions. As such, the Explorer edition is no longer available for download and the Professional edition is no longer available for purchase from Embarcadero Technologies. Turbo C++ is succeeded by C++Builder.


Turbo C++

Price :


                       0.00$


Official URL:



                                      http://sourceforge.net/projects/turbocforwindows-9          


Download URL:



                                               https://2ad7-downloads.phpnuke.org/en/c154041/turbo-c

Rating:   

                      3.8/5


Reviewer:

                             robasp2


Reviewer rating:


                                              5/5

Review date:


                                   20/5/2015



Wednesday 15 July 2015

Frequency of characters in a string

Hello and asalam o alikum. I hope you all are enjoying good health by the grace of Allah Almighty.

Today I am here with another operation of string and in this program,I will find the frequency of characters in a string.It means this program will check how many times a specific character is repeated in the string entered by the user.

The reference of this blog is taken from the following link.


Below is the source code of this program.

Source code

#include <iostream>
#include <cstring>
using namespace std;
int main(){
   char c[1000],ch;
   int i,count=0;
   cout << "Enter a string: ";
   cin.getline(c, 1000);
   cout << "Enter a character to find frequency: ";
   cin >> ch;
   for(i=0;c[i]!='\0';++i)
   {
       if(ch==c[i])
           ++count;
   }
   cout << "Frequency of " << ch <<  " = " << count;
   return 0;
}

Output

Frequency of characters in a string

.cstring header file

Remember that this header file defines several functions to manipulate C++ strings and arrays.

Tuesday 14 July 2015

Importance of semi-colon

A semi-colon is of great important in the world of programming especially C++.It is usually used to teminate a statement.But,it is very hard to find it in 500+ lines of code when you forget it !!!

semi-colon importance

Making a right-angled triangle in C++

Hello and Asalam o Alikum.I hope you all are fine by the grace of Allah Almighty.
Today I am here with a very famous program of nested loops.

You have often made a right-angled triangle on your notebook or register but today I will show you how to make it in C++. Its coding is very simple and interesting

So,have a look at its source code.

Source code


Output


How the program works? 

The outer loop of this program is from 0-5. It starts its iteration when the value is 1.
Then it jumps to the inner loop whose loop is from 1 to outer loop.As the value of loop is one, so 1 star will be displayed.

Again it jumps to the outer loop where the value now becomes 2.Then it jumps to the inner loop and the same process is repeated.This time two stars are displayed on the next line.

This process is repeated again and again until the value of outer loop becomes 6 which is against the given condition. So ,the loop is terminated.

Sunday 12 July 2015

Delaying the output in C++

Yesterday someone asked me about the function of delay in C++.I was unaware of it.So,I searched its function in C++ and finally I got the answer in a forum.

I decided to share that function with you guys.The reference of that forum will be given at the end of source code.

Delay function

First of all remember that if you want to display the output in slow motion,then you will prefer it.For example,

4 (1st second)
3 (2nd second)
2 (3rd second)
1 (4th second

Below is the source code of this program.Run this code on your compiler and clear your concepts of delay function.

Note: Copying of any content is prohibited on my blog due to security reasons.So,you cannot copy this source code.Sorry for the inconvenience.

Source code


#include <windows.h>
#include<string.h>
#include <iostream>
using namespace std;
int main( ){
    cout << "5" << endl;
    //  We use 1000 since Sleep takes the amount of time in milliseconds, and 1000 ms = 1 second
    Sleep( 1000 );

    cout << "4" << endl;
    Sleep( 1000 );
    cout << "3" << endl;
    Sleep( 1000 );
    cout << "2" << endl;
    Sleep( 1000 );
    cout << "1" << endl;
    Sleep( 1000 );

    cout << "Congratulations, you've just wasted 5 seconds of your life!";
    cin.get( );
    
    return 0;
}

This source code was written in forum by NGen on 31-08-2009.Reference of the forum is given below.


Output

5
4
3
2
1
Congratulations, you've just wasted 5 seconds of your life!

Use of  "Windows.h" header file

windows.h is a Windows-specific header file for the C/C++ programming language which contains declarations for all of the functions in the Windows API, all the common macros used by Windows programmers, and all the data types used by the various functions and subsystems. It defines a very large number of Windows specific functions that can be used in C. The Win32 API can be added to a C programming project by including the <windows.h> header file and linking to the appropriate libraries.

For reference,click the link below.

Friday 10 July 2015

Location of an engineering college

And it's a fact......you cannot deny it.....even my engineering college is located like this !!!!

engineering college's location
Engineering college location

Thursday 9 July 2015

Basic theorem of triangle

Now it is time to use C++ in our daily life.As a Mathematics student,you have read that the sum of two sides of a triangle is greater than the third side. 

So,today I am here with an interesting program that will input 3 numbers from the user and it will determine whether these sides form a triangle or not.

Below is the source code of this program.

Source code

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int a,b,c;
cout<<"Enter the value of A:";
cin>>a;
cout<<"Enter the value of B:";
cin>>b;
cout<<"Enter the value of C:";
cin>>c;
if(a+b>c && a+c>b && b+c>a)
{
cout<<"The sides form a triangle."<<endl;
}
else
{
cout<<"The sides do not form a triangle."<<endl;
}
return 0;
}

Output

property of triangle

Explanation

As the user has entered A=10,B=20,C=30. So, 

A+B>C:10+20>30.

The condition becomes false in the start and it will go into the "else" condition and will display, "The sides do not form a triangle.

Tuesday 7 July 2015

Joke of programmers

If you are a programmer,then you can spot the difference otherwise just scroll down !!!

Joke of programmers
Joke of programmers

Monday 6 July 2015

Concatenation of strings in C++


Today I am here with a program that will perform the operation of concatenation of strings of addition of strings.

Concatenation of strings

In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. 

For example,"Hello" is string # 1 and "World" is string # 2.So,after concatenation,the result will be "Hello World".

Below is the source code of this program.

Source code

#include <iostream>
using namespace std;
int main()
{
    char s1[100], s2[100];
    int i, j;
    cout << "Enter first string: ";
    cin >> s1;
    cout << "Enter second string: ";
    cin >> s2;
    for(i=0; s1[i]!='\0'; ++i);  /* i contains length of string s1. */
    for(j=0; s2[j]!='\0'; ++j, ++i) //it adds two strings
    {
        s1[i]=s2[j];
    }
    s1[i]='\0'; 
    cout << "After concatenation: " << s1;
    return 0;
}

The reference of this program is taken from Concatenation.

Output

concatenation of strings

Sunday 5 July 2015

Dev C++ for Windows

Introduction

Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler. Dev-C++ can also be used in combination with Cygwin or any other GCC based 
compiler.


  Features are :

- Support GCC-based compilers

- Integrated debugging (using GDB)

- Project Manager

- Customizable syntax highlighting editor

- Class Browser
- Function listing
- Profiling support
- Quickly create Windows, console, static libraries and DLLs
- Support of templates for creating your own project types
- Makefile creation
- Edit and compile Resource files
- Tool Manager
- Print support
- Find and replace facilities
- CVS support 


Dev C++ compiler

Price:
          0.0 $

Official URL:

                                  http://sourceforge.net/projects/orwelldevcpp/

Download URL:

                                       https://docs.google.com/ucexport=download&id=0B0RaWtQJ_R88ZFFtSld0eG1uUjg

Rating:

                4.7/5 stars   

Reviewer:

                      marsiau

Reviewer rating:

                              
                                     
                                             5/5 stars

Reviewer date: 
     
                              07/04/2015

                   
                           
          


Thursday 2 July 2015

Wednesday 1 July 2015

Code Block for Windows

Introduction

Code::Blocks is a free C, C++ and Fortran IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable.
Finally, an IDE with all the features you need, having a consistent look, feel and operation across platforms.
Built around a plugin framework, Code::Blocks can be extended with plugins. Any kind of functionality can be added by installing/coding a plugin. For instance, compiling and debugging functionality is already provided by plugins!
Code block

Price:

            0.0 $


Official URL:


                                     http://www.codeblocks.org/


Download URL:


Rating:

              4.8/5 stars


Reviewer:

 
                            ultim4t3


Reviewer rating:

                     
                                         5/5 stars

Reviewer date:


                                        08/01/2015