www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

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

#include <iostream>
// <stdlib.h> is for system("pause");
#include <stdlib.h>
int main()

{
using namespace std;
/*

Please pray for me....
Before submitting please change variables and then save against yourname.cpp
This program is written by Ali Raza Marchal
Student of Virtual University of Pakistan
BSCS[Hons] 2nd Semester
e-Mail ID: bc120403456@vu.edu.pk
Join Group Study: Skype ID: alirazamirchal
facebook.com/ali.mirchal

Question: Write a program to calculate the slope of the line
that is passing through two points and display 5 nature of slopw.

*/

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

Views: 3229

### Replies to This Discussion

cs201 solution only 10% remaining which left for u

Asslamo alikum every one,Please if any one fined any mistake and any problem please tell me i will tanks for you. And prayer for me and every one , you can reply me on my email

zahid_amz@ymail.com

kasuriamz@gmail.com

#include <iostream>
//<stdlib.h> for system pause;
#include <stdlib.h>

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

Please don't put semicolon ; at the end of comments.

Ali Raza Marchal BSCS[Hons] 2nd gud keep it up

Note for All Members: You don’t need to go any other site for this assignment/GDB/Online Quiz solution, Because All discussed data of our members in this discussion are going from here to other sites. You can judge this at other sites yourself. So don’t waste your precious time with different links.

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

Put the symbol with every cout statement

pa g kdi right solution v  dy dita kro

cout statement mn sambol lagaian sir

#include<iostream.h>//header file hai apne lecture lain smjhj aa jaye gi

#include<conio.h>//header file hai

main() // jahan bhi ye braces hoon () is ka matlab hai wo function hoga to main() ek function hai ok

{ // main body of the programe yahan se shuro hoga yahan ap apna code likhain gay

int a,b,temp; // (int) means ye data jis ke baray hum programe likh rahay hain integer type hai.(variables) (a,b,temp; etc) variables hum code main memory locations aur data storing ke liye use krtay hain. is main variable a, ka matlab hai ke ek value user se lay ke a main store karni hai second value b main aur result ke liye hum ne temp liya hai.

Cout"Enter your first value : " cout output lainay ke liye use kia jata hai

cin>>a; // cin for data input user se input lainay ke liye

Cout"Enter your second value : "

cin>>b;

The operator is referred to as the stream insertion operator. When this program executes, the value to the right of the operator, the right operand, is inserted in the output stream. Notice that the operator points in the direction of where the data goes. The characters of the right operand normally print exactly as they appear between the doublequotes. Notice, however, that the characters \n are not printed on the screen. The backslash (\) is called an escape character. It indicates that a "special" character is to be output. When a backslash is encountered in a string of characters, the next character is combined with the backslash to form an escape sequence. The escape sequence \n means newline. It causes the cursor (i.e., the current screen-position indicator) to move to the beginning of the next line on the screen.

#include<iostream.h> //header file
int slope(int); //function declaration
main ()
{
int x1; //declare the variables one on each line
int x2;
int y1;
int y2;
cout"please enter the x co-ordinate of the starting point:"; //prompt user for input
cin>>x1; //input entered by user
cout"please enter the y co-ordinate of the starting point:";
cin>>y1;
cout"please enter the x co-ordinate of the ending point:";
cin>>x2;
cout"please enter the y co-ordiante of the ending point:";
cin>>y2;

if(slope=1)
cout"line will make 45 degree angle with horizen";
if(slope<1)
cout"line will travel more along X-Axis and less along Y-Axis";
if(slope>1)
cout"line will travel more along Y-Axis and less along X-Axis";
}
{
int slope (int) //defination of slope function
slope=1;
slope=(y2-y1)/(x2-x1);

1

2

3

4

5

## Latest Activity

Huma noor left a comment for Karina Lopez
54 minutes ago
Shoaib Hasan Khan updated their profile
2 hours ago
memon added a discussion to the group CS615 Software Project Management

### cs615 midterm paper fall 2021

3 hours ago
Fahad Chaudhary, Download crackpc, Cracks Zonepc and 3 more joined Virtual University of Pakistan
4 hours ago
alvia khan posted a discussion

### Attention! All last year students and Recent Graduates! (FELLOWSHIP OPPORTUNITY)

12 hours ago
jamil sadiq posted a discussion

### ENG502 Current Midterm Paper 20/1/2022 5:30pm

14 hours ago
pcscrack posted a blog post

### EaseUS Partition Master License Code

16 hours ago
Nida Arshad Javaid Ch posted a video

### Jiss Ko Dowaon Main Manga -- Heart Touching ❤️

16 hours ago

© 2022   Created by + M.Tariq Malik.   Powered by