Looking For Something at vustudents.ning.com?Search Here

"View & Add Discussion In Main Forum By Categories Wise Select Any One Category"

# cs201

I have made my first cs201 assignment someone please tell me how I submit it ?

Views: 544

### Replies to This Discussion

sohail javaid (m.i.t 1st) upload it in CS201 assignment tab in your VULMS account...

i think .cpp file upload karni ha.

rabia ya

tariq bhai just coding file upload karni hai na???

You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks.

#include
int main()
{
using namespace std;
int X1, X2;
int Y1, Y2;

float slope, SlopX, SlopY;

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;

SlopX = (X2 - X1);

SlopY = (Y2 - Y1);

slope = (SlopY) / (SlopX);

if(SlopX == 0){
cout "Line is parallel to Y-Axis" endl;
}

else {

if(SlopY == 0){
cout "Line is parallel to X-Axis" endl;
}

else {
if(slope == 1){
cout "Line will make the 45 degree angle with the horizon" endl;
}

else{

if(slope < 1){
cout "Line will travel more along X-Axis and Less along Y-Axis" endl;
}

else {

if(slope > 1){
cout "Line will travel more along Y-Axis and Less along X-Axis" endl;
}
}
}

}

}
system("pause");
return false;
}

one more

#include
#include

main()
{
//Declaring the variable;
int x1,x2,y1,y2;
float dy,dx,slope;
//Enter the value of satarting and ending point on x-axis and y-axis;
cout"Enter the X-Cordinate of the starting point=";
cin>>x1;
cout"Enter the Y-Cordinate of the starting point=";
cin>>y1;
cout"Enter the X-Cordinate of the ending point=";
cin>>x2;
cout"Enter the Y-Cordinate of the ending point=";
cin>>y2;
//calculate difference b/w x2 and x1;
dx=(x2-x1);
//calculate difference b/w y2 and y1;
dy=(y2-y1);
//calculate slope;
slope=(dy)/(dx);
if(dx==0)
{cout"Line is parallel to Y-Cordinate"endl;
}
else
{if(dy==0)
cout"Line is parallel to X-Corndinate"endl;
}
if(slope>1)
{cout"Line will travel more along Y-Axis and less along X-Axis"endl;
}
else
if(slope<1) {cout"Line will travel more along X-Axis and Less along Y-Axis"endl; } if(slope==1) {cout"Line will make the 45 degree angle with horizon"endl; } system("Pause") ; } #include

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

#include <iostream>
int main()
{
using namespace std;
int X1, X2;
int Y1, Y2;

float slope, SlopX, SlopY;

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;

SlopX = (X2 - X1);

SlopY = (Y2 - Y1);

slope = (SlopY) / (SlopX);

if(SlopX == 0){
cout "Line is parallel to Y-Axis" endl;
}

else {

if(SlopY == 0){
cout "Line is parallel to X-Axis" endl;
}

else {
if(slope == 1){
cout "Line will make the 45 degree angle with the horizon" endl;
}

else{

if(slope < 1){
cout "Line will travel more along X-Axis and Less along Y-Axis" endl;
}

else {

if(slope > 1){
cout "Line will travel more along Y-Axis and Less along X-Axis" endl;
}
}
}

}

}
system("pause");
return false;
}

CS201 aSSIGNMENT SOL MAY 2013

 #include#includemain(){int d1,d2,e1,e2;float dx,dy;cout"Enter the X co-ordinate of the starting point=";cin>>1;cout"Enter the Y co-ordinate of the starting point=";cin>>e1;cout"Enter the X co-ordinate of the ending point=";cin>>2;dx=d2-d1;// condition if(dx==0){// statementcout"Line is parallel to Y-axis";}else{cout"Enter the Y co-ordinate of the ending point=";cin>>e2;dy=e2-e1;if(dy==0) cout"Line is parallel X-axis:";else{ if(dy/dx==1)cout"Line will make the 45 degree angle with the horizon";if(dy/dx<1)cout"Line will travel more along X-axis and less along Y-axis";if(dy/dx>1)cout"Line will travel more along Y-axis and less along X-axis";}} getch();}

#include<iostream.h>
using namespace std;

main()

{
int x1, x2, y1, y2;
float sx, sy, s;
cout"X-Coordinate of the start point= ";
cin>>x1;
cout"Y-Coordinate of the start point= ";
cin>>y1;
cout"X-Coordinate of the ending point= ";
cin>>x2;
cout"Y-Coordinate of the ending point= "
cin>>y2;
coutendl;
sx=(x2-x1);
sy=(y2-y1);
s=sy/sx;

if(sx==0)

{
cout "Line is Parallel to Y"endl;
}
else
{
if (sy==0)
{cout"Line is Parallel to X"endl;
}
else
{
if(s==1)
{cout"45 degree angle with the horizon"endl;
}
else
{ if(s<1)
{cout"more along X-Axis and less along Y-Axis"endl;
}
else
{ if(s>1)
{cout"more along Y-Axis and less along X-Axis"endl;
}
}
}
}
}
coutendl;
system("PAUSE");
}

e.g., see attachmnt 4 help its not the exact sol. its just for idea for the file to be upload.....

Attachments:

koi tu right solution do

Ye lo g right solution n plz tarik bhai isa chk krna kahin koi fault ha kya

#include <iostream>

int main()

{

int X1,X2;

int Y1,Y2;

float slope,dy,dx;

cout"Enter the X-coordinate of starting point:";

cin>>X1;

cout"Enter the Y-coordinate of starting point:";

cin>>Y1;

cout"Enter the X-coordinate of ending point:";

cin>>X2;

cout"Enter the Y-coordinate of endind point:";

cin>>Y2;

dy=(Y2-Y1);

dx=(X2-X1);

slope=dy/dx;

if

dy==0||dx==0

{

if dy==0

cout"Line is parallel to X-axis.";

else

cout"Line is parallel to Y-axis.";

}    else

{ if slope==1

cout"Line will make the 45 angle with the horizone.";

else

{if slope<1

cout"Line will travel more along X-axis and less along Y-axis.";

else

cout"Line will travel more along Y-axis and less along X-axis.";

}

}

}

1 minute ago
1 minute ago
3 minutes ago
4 minutes ago

1

2

3

4

punjab, Pakistan

• View All

• View All