Assignment No. 01 Semester: Spring 2013 CS201: Introduction to Programming 
Total Marks: 20
Due Date:02/05/2013 

Instructions: Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.
Objective:
The objective of this assignment is to provide hands on experience of:
Guidelines:


Assignment 


Problem Statement: Write the C++ language program to calculate the slope of the line that is passing through two points and displays one of the following five messages according to the nature of the slope.
Detailed Description:
Your program will ask for the two inputs for the starting point P1(x1,y1) of the line i.e. XCoordinate and YCoordinate, and two inputs for the ending point P2(x2,y2) of the line i.e. XCoordinate and YCoordinate.
Formula to calculate the slope of the line is
Slope = difference between y coordinates/difference between x coordinates
Slope can be one of the following five types depending upon its value.
Line will make the 45 degree angle with the horizon
Line will travel more along XAxis and Less along YAxis
Line will travel more along YAxis and Less along XAxis
Line is parallel to YAxis.
Line is parallel to XAxis.
For example Consider a line which passes through two points p1(10, 10) and p2(20, 18). Your program should ask for Xcoordinate of the starting point i.e. 10 Then it should prompt for the Ycoordinate of the starting point i.e. 10 Similarly your program will ask for the X and Ycoordinates of the ending point of the line i.e. 20 and 18 respectively. Now difference between y coordinates is dy = = 18 – 10 = 8 Whereas difference between x coordinates is dx = = 20 – 10 = 10 Then message should be displayed according to the nature of the slope of the line. In this case following message will be displayed.
Line shall travel more along Xaxis and Less along Yaxis.
Sample run of the program:
——– 

Assignment No. 01 Semester: Spring 2013 CS201: Introduction to Programming 
Total Marks: 20
Due Date:02/05/2013 

Instructions: Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:
Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.
Objective:
The objective of this assignment is to provide hands on experience of:
Guidelines:


Assignment 


Problem Statement: Write the C++ language program to calculate the slope of the line that is passing through two points and displays one of the following five messages according to the nature of the slope.
Detailed Description:
Your program will ask for the two inputs for the starting point P1(x1,y1) of the line i.e. XCoordinate and YCoordinate, and two inputs for the ending point P2(x2,y2) of the line i.e. XCoordinate and YCoordinate.
Formula to calculate the slope of the line is
Slope = difference between y coordinates/difference between x coordinates
Slope can be one of the following five types depending upon its value.
Line will make the 45 degree angle with the horizon
Line will travel more along XAxis and Less along YAxis
Line will travel more along YAxis and Less along XAxis
Line is parallel to YAxis.
Line is parallel to XAxis.
For example Consider a line which passes through two points p1(10, 10) and p2(20, 18). Your program should ask for Xcoordinate of the starting point i.e. 10 Then it should prompt for the Ycoordinate of the starting point i.e. 10 Similarly your program will ask for the X and Ycoordinates of the ending point of the line i.e. 20 and 18 respectively. Now difference between y coordinates is dy = = 18 – 10 = 8 Whereas difference between x coordinates is dx = = 20 – 10 = 10 Then message should be displayed according to the nature of the slope of the line. In this case following message will be displayed.
Line shall travel more along Xaxis and Less along Yaxis.
Sample run of the program:
——– 
