Zuniga_gerardo_ET4560_unit2_assigment1_questions - ET4560...

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

ET4560 UNIT2 ASSIGMENT 1 REVIEW QUESTIONS 22. Write a definition statement for a character array large enough to hold any of the following strings: "Billy Bob's Pizza" "Downtown Auto Supplies" "Betty Smith School of Architecture" "ABC Cabinet Company" const int SIZE = 40; // assign size char sentence[SIZE]; // assign char cout << "Enter a sentence: "; //ask to input a sentence cin.getline(sentence, SIZE); // use get line cout << "You entered " << sentence << endl; // out put the string return 0; 4 Assume the following variables are defined: int age; double pay; char section; Write a single cin statement that will read input into each of these variables. cin >> age; cin >> pay; cin >> setw(5) >> section; 6. Write a definition statement for a character array named city. It should be large enough to hold a string 30 characters in length const int SIZE = 30; char city [SIZE]; ET4560_Zuniga_gerardo_unit2_assigment1_questions
Image of page 1

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

Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 8. Complete the following table by wriTng the value of each expression in the Value column. Expression value 28 / 4 - 2 5 6 + 12 * 2 – 8 34 4+8* 2 20 6 + 17 % 3 – 2 6 2 + 22 * (9 - 7) 26 (8 + 7) * 2 30 (16 + 7) % 2 - 1 12 / (10 - 6) 3 (19 - 3) * (2 + 2) / 4 16 10. Assume a program has the following variable deFniTons int units; ±oat mass; double weight; and the following statement: weight = mass * units; Which automaTc data type conversions will take place? MulTplicaTon 12. Assume that qty and salesReps are both integers. Use a type cast expression to rewrite the following statement so it will no longer perform integer division. unitsEach = qty / salesReps; unitsEach = staTc_cast<int>(qty) / salesrep; ET4560_Zuniga_gerardo_unit2_assigment1_ques±ons ET4560 UNIT2 ASSIGMENT 1 REVIEW QUESTIONS ET4560_Zuniga_gerardo_unit2_assigment1_ques±ons...
View Full Document

  • Spring '16
  • UNIT2 ASSIGMENT, Betty Smith School of Architecture

{[ 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