2020-06-04 21:02:13 +04:00
|
|
|
#include <cstdio>
|
2020-06-05 02:07:37 +04:00
|
|
|
#include <cmath>
|
2020-04-26 17:26:41 +04:00
|
|
|
|
2020-05-23 00:29:44 +04:00
|
|
|
const int SIZE = 100000;
|
|
|
|
double myarray[SIZE];
|
2020-04-26 17:26:41 +04:00
|
|
|
int another_array[5] = {1, 2, 3, 4, 5};
|
2020-04-26 17:19:07 +04:00
|
|
|
|
2020-04-26 05:23:00 +04:00
|
|
|
int main()
|
|
|
|
{
|
2020-04-26 05:24:21 +04:00
|
|
|
printf("I'm a C++ program, and I'm running in user space. How about a big, Hello World\n");
|
2020-04-26 05:44:11 +04:00
|
|
|
printf("My array is at 0x%p\n", myarray);
|
2020-04-26 05:35:32 +04:00
|
|
|
printf("I'm going to start crunching some numbers, so gimme a minute.\n");
|
2020-04-26 17:26:41 +04:00
|
|
|
for (int i = 0;i < SIZE;i++) {
|
|
|
|
myarray[i] = another_array[i % 5];
|
2020-04-26 05:35:32 +04:00
|
|
|
}
|
2020-06-05 02:07:37 +04:00
|
|
|
for (int i = 0;i < SIZE;i++) {
|
|
|
|
myarray[i % SIZE] += cos(i);
|
2020-04-26 05:35:32 +04:00
|
|
|
}
|
2020-05-23 00:29:44 +04:00
|
|
|
printf("Ok, I'm done crunching. Wanna see myarray[0]? It's %lf\n", myarray[0]);
|
2020-04-26 05:23:00 +04:00
|
|
|
return 0;
|
|
|
|
}
|