Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CS201 Introduction to Programming Assignment No.1 Solution Spring Semester 2013
#1



CS201 Introduction to Programming Assignment No.1 Solution Spring Semester 2013


I have write some code this is not full code i am try to make i think there is if else statement need

#include <iostream>
#include <stdlib.h>
#include <math.h>
// Main Function
int main(){
using namespace std;

int p1,p2;

int y1,y2;

int x1, x2;

float resultSlope;
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;
resultSlope = (y2 - y1) / (x2 - x1);
}

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply
#2
[SIZE="3"]Idea Solution :[/SIZE]


#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" ;
}
}
}
}
}

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  CS508- Modern Programming Languages Assignment No. 03 Solution January 2016 Vuhelper 0 4,564 01-20-2016, 05:43 PM
Last Post: Vuhelper
  CS401 assignment no 3 Solution 20th January 2016 Vuhelper 0 10,258 01-20-2016, 05:15 PM
Last Post: Vuhelper
  Human Computer Interaction (CS408) Assignment no 3 20th January 2016 Vuhelper 0 1,067 01-20-2016, 05:13 PM
Last Post: Vuhelper
  CS101 Introduction to Computing Assignment No.2 Solution Spring Semester 2013 Vuhelper 4 12,103 12-13-2014, 01:23 AM
Last Post: Vuhelper
  ENG101 English Comprehension Assignment No.1 Solution Spring Semester 2013 Vuhelper 3 4,607 11-25-2014, 03:35 PM
Last Post: Vuhelper
  CS201 Introduction to Programming Assignment No. 3 Solution Spring Semester June 2013 Vuhelper 1 4,074 06-24-2013, 10:39 PM
Last Post: Vuhelper
  MGT101 Financial Accounting Assignment 2 Solution Spring Semester June 2013 Vuhelper 0 3,077 06-15-2013, 11:57 PM
Last Post: Vuhelper
  ISL201 Islamic Studies Assignment No.1 Solution Spring Semester 2013 Vuhelper 0 4,566 05-17-2013, 09:33 PM
Last Post: Vuhelper
  CS201 Introduction to Programming Assignment No.2 Solution Spring Semester 2013 Vuhelper 5 6,529 05-17-2013, 02:55 AM
Last Post: Xpert
  ENG201 Assignment No.2 Solution Spring Semester 2013 Vuhelper 1 5,749 05-16-2013, 04:41 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)