Coding-Mania

coding

Click here to edit subtitle

Simply Program in C++ to find Yards,Feets and Inches.

#include<iostream>

using namespace std;

void main()

{

float length;

float yard,feet,b,inches;


cout<<"\nEnter the length in Centimeters=";

cin>>length;


yard=length/36;

b=length%36;

feet=b/12;

inches=b%12;


cout<<"\nThe output is in Yards : "<<yard;

cout<<"\nThe output is in Feets : "<<feet;

cout<<"\nThe output is in Inches : "<<inches;

}


Simply Program in C++ to convert time from hours,minutes and seconds to total seconds.

#include<iostream.h>

void main()

{

int hours,minutes,seconds;


cout<<"\nEnter the hours : ";

cin>>hours;

cout<<"\nEnter the minutes  : ";

cin>>minutes;

cout<<"\nEnter the seconds : ";

cin>>seconds;


int hou_sec=hours*3600;

int min_sec=minutes*60;

int total_seconds = (hou_sec+min_sec)+seconds;


cout<<"\nTime in seconds : ";

cout<<total_seconds;

}


Simply Program in C++ to print time in hours , minutes and seconds

#include<iostream>

using namespace std;

void main()


{

int time,minutes,hours,seconds;


cout<<"\neEnter the  time :  ";

cin>>time;


hours=time/3600;

minutes=time/240;

seconds=time/320;


cout<<"\nTime in hours,minutes and seconds :  "<<hours<<":"<<minutes<<":"<<seconds;

}


Simply Program in C++ to find the area and parameters of triangle

#include<iostream.h>

void main()

{

float length,width;

float area,parameters;


cout<<"\nEnter the length of triangle : ";

cin>>length;

cout<<"\nEnter the width of triangle : ";

cin>>width;


area=width*length;


cout<<"\nArea of a triangle is : ";

cout<<area;


parameters=(width*width)+(length*length);


cout<<"\nParameters of triangle is : ";

cout<<parameters;

}


Simply Program in C++ to change Pak rupees into US Dollar

#include<iostream.h>

void main()

{

int pak;

cout<<"\nEnter the amount in Pak Rupees : ";

cin>>pak;

int dol=pak*98;

cout<<"\nThe amount in US Dollar : ";

cout<<dol;

}


Simply Program in C++ to print a table

#include<iostream.h>

void main()

{

int number,table; 

cout<<"\nEnter a number to print its table : ";

cin>>number;

for(int a=1;a<=10;a++)

{

table=number*a;

cout<<number<<" X "<<a<<" = "<<table;

}

}

Simply Program in C++ to add two numbers

#include<iostream>

using namespace std;

void main()

{

int number1;

int number2;

int sum;

cout<<"\nMy first number : ";

cin>>number1;

cout<<"\nMy second number : ";

cin>>number2;

 sum= number1+number2;

cout<<"\nSum of both numbers : ";

cout<<sum;

}


Simply Program in C++ to Print your name

#include<stdio.h>

#include<iostream>

using namespace std;

void main()

{


    cout<<"\n************************************************";

    cout<<"\n**                 PROGRAMMING           **";

    cout<<"\n**                  Language C++              **";

    cout<<"\n**              Name: UNKNOWN           **";

    cout<<"\n************************************************";

}


lahore