CourcesC++Sheet 2 2014_2015 - Tanta University Faculty of Engineering Computers and Control Engineering Dept Computer Programming st Year Students First

CourcesC++Sheet 2 2014_2015 - Tanta University Faculty of...

This preview shows page 1 - 3 out of 6 pages.

Tanta University Computer Programming ( ) Faculty of Engineering st Year Students Computers and Control Engineering Dept. First Term: With best wishes, Prof. Dr. ElSayed Sallam, Dr. Dina Mahmoud Sheet # (Chapter ) . What header file must be included in programs using cin? . Is the variable name Sales the same as sales? Why or why not? . TRUE or FALSE: cin requires the user to press the [Enter] key when finished entering data. . Describe the difference between a key word and a programmer-defined symbol. . Is the following an example of integer division or floating point division? What value will be stored in portion? int portion = ; . Which of the following are illegal variable names, and why? X , bottles , july , theSalesFigureForFiscalYear , r&d , grade_report . Write a program that has the following character variables: first, middle, and last. Store your initials in these variables and then display them on the screen. . Write a program that declares an integer variable named age and a float variable named Weight. Store your age and weight, as constants, in the variables. The program should display these values on the screen in a manner similar to the following: My age is and my weight is pounds. . Is the following assignment statement valid or invalid? If it is invalid, why? = amount; . How would you consolidate the following declarations into one statement? int x = ; int y = ; int z = ; . Write a program that asks the user to enter two numbers, obtains the two numbers from the user and prints the sum, product, difference, and quotient of the two numbers. . Write a program that asks the user to enter two integers, obtains the numbers from the user, then prints the larger number followed by the words " is larger ." If the numbers are equal, print the message “ These numbers are equal .” . Write a program that reads in the radius of a circle and prints the circle’s diameter, circumference and area. Use the constant value . for PI. Do these calculations in output statements. . Write a program that reads an integer and determines and prints whether it is odd or even. (Hint: Use the modulus operator. An even number is a multiple of two. Any multiple of two leaves a remainder of zero when divided by .) /
Image of page 1
Tanta University
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 6 pages?

  • Spring '16
  • mohamed attia
  • Computer Programming, Faculty of Engineering, Control Engineering Dept, Dr. Dina Mahmoud, Prof. Dr. ElSayed Sallam, Tanta University

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes