Powered by Blogger.

Friday, 2 December 2016

Assignment# 3 (ITP)

Share & Comment

Introduction To Programming

Question No 1:

 Write a program that ask the user to enter the two numbers, obtain the two numbers from the user and print the sum, product, difference and quotient of the two numbers

Question No 2:

 Write a program that print the numbers 1 to four on the same line with each pair of adjacent numbers separated by one space. Do this several ways
a)     Using one statement with one stream insertion operator (i.e. <<)
b)    Using one statement with four stream insertion operator
c)     Using four separate statements

Question No 3:

 Write a program that asks the user to enter two integers, obtain the number from the user, then print larger number followed by the words “is larger” if the numbers are equal, print the message “these numbers are equal”
Type the following code, compile and run with different inputs shown below

Question No 4:

 #include <iostream>
using namespace std;
main()
{
            double currentpay = 0.0;
            double raiserate = 0.0;
            double raise = 0.0;
            double newpay = 0.0;
            cout<<"enter current weekly pay:";
            cin>>currentpay;
            cout<<"enter raiserate" ;
            cin>>raiserate;
            raise = currentpay * raiserate;
            newpay = raise + currentpay;
            cout<<"newpay: " <<newpay<<endl;
}
Give the following inputs and write corresponding o utputs
Current weekly pay = 1000                         newpay:= _________________
Rate raise = 0.25

Current weekly pay = 5000                         new pay := ________________
Rate raise = 0.20

Current weekly pay = 1657.90                                new pay := _________________

Rate raise = 0.10

Question No 5:

 #include <iostream>
using namespace std;
main()
{
            int number1;
            int number2;

            cout<<"enter two numbers to comapre";
            cin>> number1 >> number2;

            if(number1==number2)
            cout<<number1<<"==" <<number2<<endl;
           
            if(number1!=number2)
            cout<<number1<< "!"<<number2<<endl;
           
            if(number1<number2)
            cout<<number1<<"<" <<number2<<endl;
}
           
Give the following inputs and write corresponding outputs
Number 1 = _______                                    output: = _________________
Number 2 = _______

Number 1 = ______                          output: = ________________
Number 2 = _______

Number 1 = _______                                    output: = _________________
Number 2 = _____________

Question No 6:

: Write a C++ assignment statement that multiplies the number 9.55 by the value stored in an int variable named hours and then assigns the result to a double variable named grossPay. Use implicit type conversion.

Question No 7:

: Rewrite the answer to Question 1 using a type cast (explicit type conversion).

Instructions:
·      Solve all questions and save them according question no.
·      Make a folder with your name. copy .cpp file in that folder and make it .rar or zip file and email me at sadafkamboh66@gmail.com till Sunday night 4/12/2016 at 11:00 P.M.
·      There will be mini quiz in class so bring your laptop with you.
·      Late submitted assignment will not be marked.
Tags: , ,

Written by

Hi friends, Shahzaib Jamal here. I am a developer to be 😊. I have very much interest in computer field and all the things that would make me better in this particular ground. I Chosed this field with a aim that one day i'll open my own Software Company. By keeping this interest in my mind i have made up this blog for you all by providing all the information on Developing subjects and other literary Subjects as well. " You will be pleased by surfing this stuff and hope it will become handy in the time of need"

0 comments:

Post a Comment

 

Popular Content

Contact Form

Name

Email *

Message *

Why to Choose BS(CS)?


  • Software Engineers
  • Database Designers
  • Database Administrators
  • Web Developers
  • Network Administrators
  • Software Quality Insurance and Testers
  • IT Consultants
Copyright © BSCS F16-S20 | Designed by SHAHZAIB JAMAL