Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

CSC112 Spring 2016 Examples

2370 views
1
#include <iostream>
2
3
using namespace std;
4
5
int main() {
6
int ar[10];
7
8
//print some basic information about the array
9
cout << "The array is " << sizeof ar << " bytes long." << endl;
10
cout << ar << endl;
11
12
//populate the array
13
cout << "Enter 10 numbers" << endl;
14
for(int i=0; i<10; i++) {
15
cin >> ar[i];
16
}
17
18
//print the array
19
cout << "You entered: " << endl;
20
for(int i=0; i<10; i++) {
21
cout << ar[i] << endl;
22
}
23
return 0;
24
}
25
26