CSEB2113: Write C++ statements to perform the following tasks: Declare a variable name my Class of type integer in an array form with size 20: Programming 1 Assignment, TNU, Malaysia
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
When searching for an expert coursework writing service, consider Malaysiaassignmenthelp.com - your destination for authentic and plagiarism-free content at a price that fits within any budget constraint! Enjoy the peace of mind of knowing you're getting original work from our experienced assignment writers delivered with errorless precision.
Recent Solved Questions
- BBFA2203: The balance sheet date of BumBum Berhad is 31 December 2020 and the meeting of the Board of Directors is 25 March 2021: Intermediate Financial Accounting Assignment, OUM, Malaysia
- DPB40103: Whether you have a roommate by choice, by necessity, or through the random selection process of your school’s housing: Organizational Behavior Case Study, PM, Malaysia
- Figure 1 shows an electric circuit network. Using the proper tree in Figure 2, determine all the voltage and current for each edge: Network Analysis Assignment, CUSCT, Malaysia
- EEE40002: Ability to evaluate the CMOS transistor characteristics and Conduct investigations of complex problems using research-based knowledge: Integrated Circuit Design Assignment, SUT, Malaysia
- MGT555: In 2021, the price charged for bottled drinks/box is RM10 for passion fruit, RM8 for mango, and RM6 for calamansi: Business analytics Report, UiTM, Malaysia
- BBUI3103 EMPLOYMENT AND INDUSTRIAL LAW – University of Malaysia
- FIN30014: Industrial commodities in China mostly rose as the number of Covid-19 cases fell and the government began to loosen the restrictions: Financial Risk Management Case Study, SUT, Malaysia
- MGT 507: The covid-19 crisis impacted the world continuously including individuals, society, economics, and business: Research Methodology Research Paper, LUC, Malaysia
- Discuss the mechanism of the skeletal and muscular systems as well as elaborate on the importance: Anatomy & Physiology Essay, IIUM, Malaysia
- Antifreeze, or engine coolant, is a coloured liquid that is mixed with water to help regulate the engine during extreme temperatures: Chemical Engineering Assignment, HWU, Malaysia