~Lecture5.pptx - C/C Instructions Type Declaration...

Info icon This preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
1 C/C++ Instructions Type Declaration Instruction To declare the type of variables used in a C /C++ program. Arithmetic Instruction To perform arithmetic operations between constants and variables Control Instruction To control the sequence of execution of various statements in a C/C++ program.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Type Declaration Instruction This instruction is used to declare the type of variables being used in the program. int hours, payrate, grosspay; float salary; char name;
Image of page 2
3 Variations of type declaration instruction Initializing at declare time int x =10, y = 20; float a = 1.25, b = 1.99*2.4+1.5; Order of variable declaration int i = 10, j = 25 ; is same as int j = 25, i = 10 ; However, float a = 1.5, b = a + 3.1 ; is alright, but float b = a + 3.1, a = 1.5 ;
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Cont. The following statements would work int a, b, c, d ; a = b = c = 10 ; However, the following statement would not work int a = b = c = d = 10 ;
Image of page 4
5 Arithmetic Instruction C/C++ arithmetic instruction consists of variable name on the left hand side of = and variable names & constants on the right hand side of =.
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

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