PF Assignment 01

advertisement
Shaheed Zulfikar Ali Bhutto Institute of Science & Technology
COMPUTER SCIENCE DEPARTMENT
Total Marks:
04
Obtained Marks:
Fundamentals of
Programming
Assignment # 01
Last date of Submission: 18th February, 2019
Submitted To:
______________________________________________________________________________
Student Name:
______________________________________________________________________________
Reg Number:
_______________________________________________________________________________
Fundamentals of Programming
BSC/BS-1(A)
SZABIST-ISB
Shaheed Zulfikar Ali Bhutto Institute of Science & Technology
COMPUTER SCIENCE DEPARTMENT
Instructions: Copied or shown assignments will be marked zero. Late submissions are not
entertained in any case.
Question No. 01 (05 Marks)
Write a single C++ statement to accomplish each of the following (assume that using declarations
have not been used):
a. Declare the variables c, thisIsAVariable, q76354 and number to be of type int.
b. Initialize the variables declared in part a,
c. Prompt the user to enter an integer. End your prompting message with a colon (:) followed
by a space and leave the cursor positioned after the space.
d. Print the message "This is a C++ program" with each word on a separate line.
e. Print the message "This is a C++ program" on two lines. End the first line with C++.
Code
(Write your code for the task)
Output
(Screenshot for task’s output).
Question No. 02 (05 Marks)
Write a program that will take the two Floating values from the user as input and perform the
following tasks:
a. Print the Sum of inputs.
b. Print the Subtraction of inputs.
c. Print the multiplication of inputs.
d. Print the division of the inputs.
e. If any of the result comes less 1, print “Result is less then one”;
Code
(Write your code for the task)
Fundamentals of Programming
BSC/BS-1(A)
SZABIST-ISB
Shaheed Zulfikar Ali Bhutto Institute of Science & Technology
COMPUTER SCIENCE DEPARTMENT
Output
(Screenshot for task’s output).
Question No. 03 (05 Marks)
Solve the following equations manually step by step according to operator precedence in C++ ,
also write the code to solve it using Visual studio.
Manual Solution of Equation
(solve the equation step by step as done in lecture)
Code
(Write your code for the task.)
Output
(Screenshot for task’s output).
Fundamentals of Programming
BSC/BS-1(A)
SZABIST-ISB
Download