We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

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

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

 

Instructions:

Please read the following instructions carefully before submitting assignment. It should be clear that your assignment will not get any credit if:

 

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Assignment is copied(partial or full) from any source (websites, forums, students, etc)

 

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted and will be awarded with zero marks. For example, if you submit code in .doc (Word document) or .txt files or .exe file, no reward will be given in any case.

 

 

Objective:

 

The objective of this assignment is to provide hands on experience of:

 

  • Basic concepts of C/C++ language and Programming
  • Dealing with Data types
  • Conditional statements of C/C++ language
  • Expressions
  • Saving a program
  • Compiling a program
  • Executing the program

 

 

Guidelines:

 

  • Code should be properly indented and well commented.
  • Follow C/C++ rules while writing variable names, function names etc
  • Use only dev-C++ for this assignment.

 

 

 

 

 

 

 

 

 

 

 

 

 

Assignment  

 

 

Problem Statement:     

Write the C++ language program to calculate the slope of the line that is passing through two points and displays one of the following five messages according to the nature of the slope.

 

Message No

Description

1

Line will make the 45 degree angle with the horizon

2

Line will travel more along X-Axis and Less along Y-Axis

3

Line will travel more along Y-Axis and Less along X-Axis

4

Line is parallel to Y-Axis.

5

Line is parallel to X-Axis.

 

Detailed Description:

 

Your program will ask for the two inputs for the starting point P1(x1,y1) of the line i.e. X-Coordinate and

Y-Coordinate, and two inputs for the ending point P2(x2,y2) of the line i.e. X-Coordinate and Y-Coordinate.

 

Formula to calculate the slope of the line is

 

Slope = difference between y coordinates/difference between x coordinates

         

 

Slope can be one of the following five types depending upon its value.

 

  • Slope=1

            Line will make the 45 degree angle with the horizon

 

  • Slope<1

             Line will travel more along X-Axis and Less along Y-Axis

 

  • Slope>1

               Line will travel more along Y-Axis and Less along X-Axis 

 

  • Your program should have a check for the value of difference between X coordinates of the two points i.e. dx. In case difference between x coordinates is zero then slope should not be calculated in your program and following message should be displayed.

 

              Line is parallel to Y-Axis.

 

  • Your program should have a check for the value of difference between Y coordinates of the two points i.e. dy.  In case if the difference between y coordinates is zero then following message should be displayed.

 

               Line is parallel to X-Axis.

 

For example Consider a line which passes through two points p1(10, 10) and p2(20, 18).

Your program should ask for X-coordinate of the starting point i.e. 10

Then it should prompt for the Y-coordinate of the starting point i.e.  10

Similarly your program will ask for the X and Y-coordinates of the ending point of the line i.e. 20 and 18 respectively.

Now difference between y coordinates is dy =  = 18 – 10 = 8

Whereas difference between x coordinates is dx =  = 20 – 10 = 10

         

        

Then message should be displayed according to the nature of the slope of the line.  In this case following message will be displayed.

 

 Line shall travel more along X-axis and Less along Y-axis.

 

Sample run of the program:

 

 

 

 

 

 

--------

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2342

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

Please Discuss here about this assignment.Thanks

Our main purpose here discussion not just Solution

We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.

Ye assignment bht hi asan hai lihaza ghabranay ki koi zrort nai hai

karna kia hai 2 variable banain jo input values ko store karain ek variable temp lain jo unka result show kre temperary kafiat main. jab ye kar lain to user se 2 values lain ye honay ke bad condition dain aur formula dain bs out put apki marzi ka hoga.

koshish kre ke apna code likhain jahan mistake ho yahan share karin or sab mil kar iun error ku remove karin 

 main() 

is a part of every C++ program. The parentheses after main indicate that main is a program building block called a function. Exactly one function in every program must be main.

The left brace{ must begin the body of every function. A corresponding right brace}, must end each function's body.

semicolon (;), is called a statement. Every C++ statement must end with a semicolon (also known as thestatement terminator). Preprocessor directives (like #include) do not end with a semicolon.

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.

This is the deatil about objectives of assignment

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

Sir, it's really helpful not only 1 sem bt us.

CS201 Assignment#01 Solution Hints

sab se pehle 4 integer variables declare karein

like int a1,a2,b1,y2

phir 3 float variable declare karein

like float a,b,c

aub pehle 4 variables mein x aour y coordinate ki value input le le

like cout"Enter value for x1 "; cin>>a1;

cout"Enter value for y1 "; cin>>b1;

cout"Enter value for x2 "; cin>>a2;

cout"Enter value for y2 "; cin>>a2;

lo ji aadha kam to ho gia

aub a mein dx ko rakhwa dein like

a = a2-a1

aour

b mein dy ko rakhwa dein like

b = b2-b1

aub simple if structure aour and operator ka kam hai bas

aour assignment khatam

maslan

if (a==0) then print kar do keh

"Line is parallel to Y axis"

                                                  point to be noted aour agar b bhe 0 ho to  ........... just think and share your ideas

lo ji aub slop nikal lo

c = dy/dx

yaani c = b/a

aub thora mazedaar kam hai

agar to c>1 then

print what you want to print like see assignment

and if c<1 then print the other statement.

I think this is enough to understand the assignment

if anybody still have any confusion, just discuss

This forum will help a lot

program pura bn gya hai bx ye ni smj a rhe k jb "b2 - b1 == 0" ya a2 - a1== 0 ho toe ye message "Line is parallel to Y axis" Or  "Line is parallel to X axis"  kxe print krwana hai...kyun k jb mai condotion use krta hn toe 2 message(output) atae hain kyun k " c<1 " walo condition  b meet kr jti hai...plz help

same here brother!! I also get two messages displayed when b==0.

ap ne dy/dx lagaya hoga to ye nae aye ga aur ap looping b check karo if else ki

RSS

Latest Activity

maria ali added a discussion to the group STA630 Research Methods
11 minutes ago
maria ali joined + M.Tariq Malik's group
12 minutes ago
+!!! Annie !!!+ liked + M.Tariq Malik's group EDU302 Human Development and Learning
17 minutes ago
+!!! Annie !!!+ liked №Oř's group Novels and Famous e books
17 minutes ago
+!!! Annie !!!+ liked + M.Tariq Malik's group CS204 Cyber Law
17 minutes ago
+!!! Annie !!!+ liked + M.Tariq Malik's group EDU433 Professionalism in Teaching
18 minutes ago
+!!! Annie !!!+ liked + M.Tariq Malik's group EDU654 Addressing problems of learning through technology and pedagogy
18 minutes ago
+!!! Annie !!!+ liked + M.Tariq Malik's group EDU630 Research Project - Education
18 minutes ago
+!!! Annie !!!+ liked + M.Tariq Malik's group TPT620 Teaching Practice (Long Term)
18 minutes ago
Ahad Kharal replied to + M.Tariq Malik's discussion CS625 Professional Practices Assignment No 01 Fall 2019 Solution & Discussion in the group CS625 Professional Practices
29 minutes ago
Ahad Kharal joined + M.Tariq Malik's group
29 minutes ago
DANI added a discussion to the group MGT101 Financial Accounting
33 minutes ago
abdul ghafoor replied to + M.Tariq Malik's discussion PSY404 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 20-11-2019 in the group PSY404 Abnormal Psychology
34 minutes ago
abdul ghafoor replied to + M.Tariq Malik's discussion PSY404 Assignment No 01 Fall 2019 Solution & Discussion Due Date: 20-11-2019 in the group PSY404 Abnormal Psychology
35 minutes ago
Profile IconAli Haider, samar bilal and + '' Tanveer '' joined + M.Tariq Malik's group
42 minutes ago
ALEENA replied to + M.Tariq Malik's discussion How to Prepare The Mid Term Exams & Study in VU
47 minutes ago
Isha Chuhdary updated their profile
48 minutes ago
ALEENA replied to + M.Tariq Malik's discussion How to Get Full Marks In Quiz
56 minutes ago
ALEENA liked + M.Tariq Malik's discussion How to Get Full Marks In Quiz
57 minutes ago
ALEENA replied to +¢αяєℓєѕѕ gιяℓ's discussion Kya Mien Writer Ban Sakti Hoon :-P
1 hour ago

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

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