You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1017 B
40 lines
1017 B
6 years ago
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
#define NUMBER_OF_ROWS 3
|
||
|
#define NUMBER_OF_COLUMNS 2
|
||
|
|
||
|
|
||
|
int main(int argc, char const *argv[]){
|
||
|
double pointsArray[NUMBER_OF_ROWS][NUMBER_OF_COLUMNS];
|
||
|
int row, column;
|
||
|
|
||
|
/*for (row=0; row<NUMBER_OF_ROWS; ++row){
|
||
|
for (column=0; column<NUMBER_OF_COLUMNS; ++column){
|
||
|
pointsArray[row][column] = rand() * 12.8;
|
||
|
printf("pointsArray[%d][%d] = %f\n", row, column, pointsArray[row][column]);
|
||
|
}
|
||
|
}*/
|
||
|
pointsArray[0][0] = 0.0;
|
||
|
pointsArray[0][1] = 1.0;
|
||
|
|
||
|
pointsArray[1][0] = 0.0;
|
||
|
pointsArray[1][1] = 2.0;
|
||
|
|
||
|
pointsArray[2][0] = 0.0;
|
||
|
pointsArray[2][1] = 3.0;
|
||
|
|
||
|
for (row=0; row<NUMBER_OF_ROWS; ++row){
|
||
|
for (column=0; column<NUMBER_OF_COLUMNS; ++column){
|
||
|
printf("pointsArray[%d][%d] = %f\n", row, column, pointsArray[row][column]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
FILE *pointsBinaryFile;
|
||
|
pointsBinaryFile = fopen("points.bin","wb");
|
||
|
fwrite(pointsArray, sizeof(double), NUMBER_OF_ROWS * NUMBER_OF_COLUMNS, pointsBinaryFile);
|
||
|
fclose(pointsBinaryFile);
|
||
|
|
||
|
printf("Done!");
|
||
|
scanf("%d", &row);
|
||
|
}
|