#include<stdio.h>
#include<stdlib.h>
void init(char*filename)
{
FILE* f = fopen(filename,"w");
fprintf(f,"%d ",8);
fprintf(f,"%d ",6);
int i, j;
for(i = 0; i < 8; i ++)
{
for(j = 0; j < 8; j ++)
{
fprintf(f,"%d ", rand()%6);
}
}
fclose(f);
}
int main()
{
init("input.txt");
}
when I open file I see this:
*‸‶‵‵‴‴‵‴‰‰‴′‵‵‱″‱‵‱′″‰″‰′″‴‴″′′‵‵‰‵‰″‴‵‱‱‰‵″′″″′″‱‵‴‵′‴″″‱‵″‱‴‴‵′‰*
Why don't I see the values of rand()%6
that were printed to this file??
I use Dev-C++ 5.6.3 to run the program and save it with format .cpp, Open with Notepad