Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

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


#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: 3198

Replies to This Discussion

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

#include <iostream>
#include <stdlib.h>
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;
  }
right or wrong

koi b solution correct nai hay sab me errors hn.... need correct solution

Ayesha is r8.......... every file has some errors which is not compiling the code.........

Complete solution

Plz Compile and Run

Attachments:

Yes. It is r8 code. Thank u so much Subhan.................................... God Bless U.

Fazli subhan thanks for sharing 

RSS

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

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service