Im have trouble reading a file till its the end of a file using I/O redirection with my Quincy 2005 compiler. My first while loop is supposed to do this and i dont know how to start it. Can someone please help me.
Code:#include<stdio.h> int main (void) { int sampleID; int i, j; double num_of_genes; int length_exon; int intron; int countC = 0; int countA = 0; int countT = 0; int countG = 0; char x, y; double meanA; double meanC; double meanT; double meanG; int type; int counter; printf("\nID mA mT mG mC Type"); while (counter < 30) { scanf("%d", &sampleID); scanf("%d", &num_of_genes); scanf("%d", &length_exon); intron = 3 * length_exon + 1; for (i = 0; i < num_of_genes; i++) { while(scanf("%c", &x) <= length_exon) { if (x == 'A') countA++; else if (x == 'C') countC++; else if (x == 'T') countT++; else if (x == 'G'); countG++; for (j = 0; j <= intron; j++) scanf("%c", &y); } } meanA = countA / num_of_genes; meanC = countC / num_of_genes; meanT = countT / num_of_genes; meanG = countG / num_of_genes; if (meanC <= meanA && meanA <= meanT && meanT <= meanG) type = 1; else if (meanA <= meanC && meanC <= meanT && meanG > 0) type = 2; else type = 3; printf("\n%d %lf %lf %lf %lf %d", sampleID, meanA, meanT, meanG, meanC, type); counter++; } return 0; }



LinkBack URL
About LinkBacks



