https://www.google.com/contributor/welcome/?utm_source=publisher&utm_medium=banner&utm_campaign=2376261057261409

Search This Blog

Search with our Site

Custom Search

Saturday, April 27, 2013

Final Solution Assignment No. 01 Spring 2013 CS201 Introduction to Programming

Please Do not copy paste its my orignal file
#include <iostream.h>

main()

{
// Declaring variables for input (x,y) and (x1,y1)
int a,b,c,d;
// Declaring variables for formula dx(x1 - x) and dy(y1 - y)
float m,x,y;

cout "Enter the X - Coordinate of the Starting point = ";
cin>> a;

cout "Enter the Y - Coordinate of the Starting point = ";

cin>> b;

cout "Enter the X - Coordinate of the Ending point = ";

cin>> c;

cout "Enter the Y - Coordinate of the Ending point = ";

cin>> d ;
// acording to formula dx(x1 - x)
x = c-a ;
// show message if the resualt (x1 - x)= 0
if (x==0)
{ cout "Line is parallel to Y - Axis ";
}
else
{
// show message if the resualt (y1 - y)= 0
y = d-b ;
if (y==0)
{ cout "Line is parallel to X - Axis ";
}
else
{
// show message if the resualt (dy/dx )= 1
m = y/x;
if (m==1)
{
cout "Line will make the 45 degree angle with the Horizon ";
}
else
{
// show message if the resualt dy/dx > 1
if (m>1)
{
cout "Line will travel more along Y- Axis And less along X- Axis" ;
}
// show message if the resualt dy/dx < 1
if (m<1)
{
cout "Line will travel more along X- Axis And less along Y- Axis" ;
}
}
}
}
}

 

No comments:

Post a Comment