Kanjut SHELL
Server IP : 172.16.15.8  /  Your IP : 3.141.32.53
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/jmsanchez/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jmsanchez/array1.cpp
#include <iostream>

using namespace std;

int main()
{
	//decl.
	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.1;

	// Q: out the 10th, 20th, 30th, 40th?
	// cout << myArr[9] << "\t" << myArr[19] << "\t" << myArr[29] << "\t" << myArr[39] << endl;
	// Q: what are the outputs
	// 77.7 77.7 77.7 71.1

	// Q: out put ALL?
	// for(int i=0; i<MAX; i++)
	//	cout << myArr[i] << endl;

	// Q: Make all 0s?
	for(int i=0; i<MAX; i++)
		myArr[i] = 0;
		cout << myArr[i] << endl;
		
	cout << "\n\nWORKS!!!\n\n";
	return 0;
}

Stv3n404 - 2023