Server IP : 172.16.15.8 / Your IP : 18.219.207.115 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/mrlong/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
// show the using an array #include <iostream> using namespace std; int main() { // del. const int MAX = 50; float myArr[MAX]; // Q: First element as 50.3 myArr[0] = 50.3; //Q: The rest are 77.7 for( int i=1; i<=MAX-1; i++) myArr[i] = 77.7; //Q: the 40th - 50th ones are changed to 71.7? for( int i=39; i<=49; i++) myArr[i] = 71.7; //Q: out the 10th, 20th, 30th, 40th? cout << myArr[9] << "\t" << myArr[19] << "\t" << myArr[29] << "\t" << myArr [39] <<endl; //Q: What is the output? // 77.7 77.7 77.7 71.7 //Q: output all? for( int i=0; i<MAX; i++) cout << myArr[i] << endl; //Q: Make all 0's? for( int i=0; i<MAX; i++) myArr[i] = 0; cout << "\n\nWorks!!!\n\n"; return 0; }