CSEB2113: Programming 1 Assignment, TNU, Malaysia Write C++ statements to perform the following tasks: Declare a variable name my Class of type integer in an array form with size 20
University | Tenaga National University (TNU) |
Subject | CSEB2113: Programming 1 |
Q1. Write C++ statements to perform the following tasks:
- Declare a variable name myClass of type integer in an array form with size 20
- Assigning a value 9 to a name variable fixVar using #define preprocessor directive
- Declare a variable name mySum of type double and assign a value 10 to the variable
Q2. Refer to the below table:
a) Locate and explain the errors (by indicating the line number)
b) Correct the above errors.
Q3. Analyze the following program fragment:
Modify the above, so that it displays two messages “You have failed the exam!” and “Please study to improve your grade”, if marks are less than or equal to 50.
Q4. Re-write the following program fragment using switch statements without changing its logic
Q5. Answer the following:
- Write the function prototypes for each of the following:
i. Function hypotenuse() that takes two double-precision floating-point parameters, side1 and side2, and returns a double-precision floating-point result.
ii. Function instructions() that do not receive any input parameters and do not return a value. - Define the C++ function called product() that reads three integers and finds the largest inside the function.
Q6. Answer the following questions, given the declaration of an array of type float called CGPA with its elements as stated below.
a) Write a C++ statement to assign 2.00 as a new value to the second element of the array.
b) Determine the number of elements that the CGPA array has.
c) Using an appropriate loop, write a C++ program fragment to display each array element one by one given int index;
Q7. Given the declarations below, answer all the following questions:
a) Write a C++ statement to copy the whole string from lyric to play.
b) Write a C++ statement to copy only 10 characters from the lyric to backup.
c) Write a C++ statement to find the difference between the strings between play and lyric by comparing them using an appropriate built-in function used to compare strings. Then, display the differences on the screen.
Get Solution of this Assessment. Hire Experts to solve this assignment for you Before Deadline.
Get Help By Expert
Looking for high-quality online essay help in Malaysia? AssignmentHelper.my can help! Our team of experienced writers will help you with everything from drafting the initial ideas to finalizing the final product. Look no further! We also provide support for specific subjects like "ABKK1103: Introduction To Political Science Assignment" We guarantee that our assignment writing help will make your writing process much easier and more enjoyable. So why not give us a try? You won't regret it!
Recent Solved Questions
- Animal Crossing Thesis, OUM, Malaysia The rationale of the study is to investigate the communicative competence of the English language among Malaysian adult players
- Strategic Management Home Work, ASB, Malaysia You are going to operate a convenience store in the city you live selling only imported products from Korea
- NBHS1213: Discuss the anatomy and physiology of a peripheral circulatory system as well as the pathophysiology of a cardiopulmonary system for a patient: Anatomy And Physiology 2, Assignment, OUM, Malaysia
- Bachelor of Performing Arts Assignment, TU, Malaysia Discuss three symbolisms in the play Macbeth and how they support the central theme of the play
- BBBL2074: Business and Corporate Law Assignment, TARC, Malaysia Olive Foods Sdn. Bhd. is a relatively small company incorporated in Malaysia having its business premises in Rawang
- BDNG3103: Introductory International Business Assignment, OUM, Malaysia Assume that Proton plans to expand its market by setting up a new production facility in Saudi Arabia in the year 2023
- MPU2163: Pengajian Malaysia Essay, IIU, Malaysia Mencapai keputusan yang cemerlang dalam pelajaran adalah pencapaian yang diidam-idamkan oleh semua yang bergelar pelajar
- Advanced Financial Management Assignment, UUM, Malaysia Show an excellent description and discussion of issues and material with evidence of critical evaluation of issues and material
- Bachelor of Economics Assignment, HU, Malaysia Students are required to look through the given articles in HLMS and choose one of the topics which they are comfortable
- BBIM4103 International Marketing Assignment, OUM, Malaysia