Top Banner

Click here to load reader

of 33

CS2311 Computer Programming

Jan 02, 2016

Download

Documents

ohanzee-ojeda

CS2311 Computer Programming. Dr. Yang, QingXiong (with slides borrowed from Dr. Yuen, Joe) LT5: Array (1D and 2D). Syntax Summary. Punctuators [ … ]. Example 1. Input the marks for 10 students Store the marks in variables Compute the average marks - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Introduction to Programming

Dr. Yang, QingXiong(with slides borrowed from Dr. Yuen, Joe)

LT5: Array (1D and 2D)CS2311 Computer ProgrammingSyntax Summary2Punctuators[]Example 13Input the marks for 10 students Store the marks in variablesCompute the average marksPrint the marks of the students and the average100 30 44 66 50 60 80 75 80 100The mark of the students are: 100, 30, 44, 66, 50, 60, 80, 75, 80, 100Average mark=68The program4/*define variables for storing 10 students' mark*/int mark1, mark2, mark3, mark4, mark5, mark6, mark7, mark8, mark9, mark10, average;

/*input marks of student*/cin >> mark1 >> mark2 >> mark3 >> mark4 >> \\mark5 >> mark6 >> mark7 >> mark8 >> mark9 >> mark10;

/*print the marks*/cout digit;if (digit>=0 && digit