Question
i keep getting the error Program generated too much output. Output restricted to 50000 characters. Check program for any unterminated loops generating output. how do
i keep getting the error "Program generated too much output. Output restricted to 50000 characters. Check program for any unterminated loops generating output." how do i fix it?
My code:
#include
struct studentRecord{ int netID; double GPA; };
typedef struct studentRecord Student;
int linearSearchID(Student list[],int numElems,int value) //Linear search { int i; for(i=0;i return -1; } void modifiedSortGPA(Student array[],int size) //Sorting using bubble sort { int i,j; Student temp; for(i=0;i } int main() { Student studArray[NUM_ELMTS]; //Original array of student structures Student copySortedbyGPA[NUM_ELMTS]; //Copy of original array that will be sorted int netIDArray[NUM_ELMTS]={23830,32505,19574,16513,11529,13026,3768,1031,22229,7851}; double GPAArray[NUM_ELMTS]={3.64,2.1,3.89,2.21,3.83,3.99,3.76,2.94,2.95,2.01}; int i,ch,n,netid,search; for(i=0;i copySortedbyGPA[i]=studArray[i]; //Copying the student array } modifiedSortGPA(copySortedbyGPA,NUM_ELMTS); printf("Original array of structures: "); printf("-----------------------------"); printf(" Index netId GPA"); for(i=0;i printf(" Array of structures sorted by GPA: "); printf("----------------------------------"); printf(" Index netId GPA"); for(i=0;i do { printf(" *************** "); //Menu printf("Menu of choices "); printf("*************** "); printf("1->List the top n students " "2->Search for a student by NetID " "3->Quit "); scanf("%d",&ch); switch(ch) { case 1: printf("Enter n: "); scanf("%d",&n); printf("Top %d students are: ",n); printf(" netID GPA "); for(i=NUM_ELMTS-1;i>NUM_ELMTS-n-1;i--) printf(" %5d %4.2f",copySortedbyGPA[i].netID,copySortedbyGPA[i].GPA); break; case 2: printf("Enter net ID: "); scanf("%d",&netid); search=linearSearchID(studArray,NUM_ELMTS,netid); if(search==-1) printf("Student not found"); else printf("Student found at index %d, GPA is %.2f",search,studArray[search].GPA); break; case 3: printf("Exiting "); break; } }while(ch!=3); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started