CLICK HERE FOR VARIOUS NEW JOBS 
CLICK HERE FOR VARIOUS EDUCATIONAL NEWS 
CLICK HERE FOR NEW SCHOLARSHIPS 
CLICK HERE FOR ADMISSION NOTICES 
Click And Follow On Google+ To Get Updates
Please Wait 10 Seconds... OR You CanSkip

ADMISSION NOTICES
Scholarships

Scholarship-300x291

BUDGET 2014-15
budget_2014-2015
New Date Sheets
VU SOLVED ASSIGNMENTS
Recent Posts

Posts Tagged ‘VU Assignment No. 01 Semester: Spring 2013 CS201: Introduction to Programming Solved By VU’

VU Assignment No. 01 Semester: Spring 2013 CS201: Introduction to Programming Solved By VU

VU Assignment No. 01 Semester: Spring 2013 CS201: Introduction To Programming Solved By VU

#include <iostream>
using namespace std;

int main()
{
// variable declaration.
float dy, dx, x1, x2, y1, y2;
float slope;

cout<<“Enter the X-Coordinate of the starting point=”;
cin>>x1;
cout<<“Enter the Y-Coordinate of the starting point=”;
cin>>y1;
cout<<“Enter the X-Coordinate of the Ending point=”;
cin>>x2;
cout<<“Enter the Y-Coordinate of the Ending point=”;
cin>>y2;

// test for condition when dx i.e. (x2-x1)==0
// if this condition is true program will be terminated after the return 0; statment
// slope will not be calculated just message will be displayed
if((x2-x1)==0)
{
cout<<“Line is parallel to Y Axis”;
system(“PAUSE”);
return 0;
}
else // slope will be calculated and value of slope will be stored in slope variable having data type float
slope=(y2-y1)/(x2-x1);

if(slope==0) // test for condition when value of slope variable is equal to 0
cout<<“Line is parallel to X-Axis.”<<endl;

else if(slope<1) // test for condition when value of slope variable is less than 1
cout<<“Line will travel more along X-Axis and Less along Y-Axis”<<endl;

else if(slope==1) // test for condition when value of slope variable is equal to 1
cout<<“Line will make the 45 degree angle with the horizon”<<endl;

else if(slope>1) // test for condition when value of slope variable is greater than 1
cout<<“Line will travel more along Y-Axis and Less along X-Axis”<<endl;

cout<<“Slope: “<<slope<<endl; // Not required to be printed according to assignment
system(“PAUSE”);
}

VU Assignment No. 01 Semester: Spring 2013 CS201: Introduction To Programming Solved By VU

ALL NEW RESULTS
Educational News

Updated Educational News

Categories
POSTS BY DATE
December 2016
M T W T F S S
« Sep    
 1234
567891011
12131415161718
19202122232425
262728293031