Hi guys I have been trying to teach myself C for about 2 weeks now. To get more practice I decided to program my alogorithms class program in C instead of java( I dont't like java).
Here is my question:
I have to input from stdin so my input is
Code:
5
00101
00100
11001
00000
10100
5
01010
10101
01011
10101
01110
so I'm trying to figure how do I wirte my code accept this from standard in.
This is what I have so far: *note*this is not the whole program
Code:
scanf("%d", &nn);
for (i = 0; i < nn; i++)
for (j = 0; j < i; j++)
cc =getchar()
This is some code I found that inputs random 1's and 0's into a matix
Code:
void complete_graph(int nv)
{
int **mat;
int i, j;
mat = initialize_mat();
for (i = 0; i < nv; i++) {
for (j = 0; j < nv; j++)
mat[i][j] = 1;
}
for (i = 0; i < nv; i++)
mat[i][i] = 0;
print_mat(mat);
}
Sorry I wrote so much hope I got my point across
Thx in advance