Electrical and Computer Engineering
4 of 17
UAH
CPE 112
Array Examples
•Consider the following declarations:
• float angle[4];
• int testScore[10];
•
•and the assignments:
• angle[0] = 4.93; angle[2] = 0.5;
• angle[1] = -15.2; angle[3] = 1.67;
•
•Each array component can be treated exactly the same as any simple variable of type float.
•
• Ex: angle[2] = 9.6;
•      cin >> angle[2];
•     cout << angle[2];
• y = sqrt(angle[2]);
•    x = 6.8 * angle[2] + 7.5;