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 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 Assignment, UPM, Malaysia New Horizons (ACNH) and how it affects their communicative anxiety when interacting with other players
- The strategic role of HRM is becoming vital in ensuring the success and failure of business operations: Strategic, HR Planning, Selection and Recruitment Assignment, OUM, Malaysia
- Computational Thinking Assignment, MU, Malaysia Computational thinking is an approach to problem-solving that involves critical and logical thinking in order to solve problems
- Business Research Method Dissertation, MUM, Malaysia What is the impact of Corporate Governance Practices on the Organisational Reputation of SMEs in Malaysia
- Finance Accounting and Management Assignment, UON, Malaysia Choose any three 3 accounting standards that you have learned in the class and discuss briefly those standards in regard to their recognition
- Economics Assignment, UiTM, Malaysia In terms of economic growth, the impacts of the crisis have been severe. The Malaysian economy contracted by 17.1 percent
- BFW3651: Treasury Management Assignment, MUM, Malaysia Due to the multiplicity and complexity of non-financial and financial risks, as well as uncertainties to a bank
- LAW416: Business Law Assignment, UiTM, Malaysia Karim ordered 100 packets of gummy bears from Julie. He instructed Julie to pack 20 packets in 5 boxes to be sent
- Identify and discuss the reasons for Asda to conduct workforce planning: Human Resource Management Essay, UTM, Malaysia
- MEDS1159: Corporate Communications Case Study, UOG, Malaysia Coursework is receipted on the understanding that it is the student’s own work