I have a function that loops until y, n is the correct answer, but at the end of the selection I get an error:
Time Check Failure
ive looked at google and could not find any relivent answers to this error, my code looks like this:
void Mesh_equations(float a,float b,float c,float d,float e,float f){ char YESNO[1]; //define variables. int loop=0; //loop set to zero. while(loop==0){ //while loop initiated whilst loop is equal to zero. cout <<"\nDo you want to display your coefficients for the mesh equations...(y/n)?"; cin>>YESNO; //prompt and cin. if ( YESNO[0] == 'Y' || YESNO[0] == 'y'){ //if cin is 'Y' or 'y' system("CLS"); cout<<"Loop One:\n(" <<a <<")" <<"Ix + (" <<b <<")" <<"Iy = (" <<e <<")" <<endl <<"Loop Two:\n(" <<c <<")" <<"Ix + (" <<d <<")" <<"Iy = (" <<f <<")" <<endl<<endl <<setw(5)<<" Where ;\n" <<setw(5)<<"A ="<<a<<endl <<setw(5)<<"B ="<<b<<endl <<setw(5)<<"C ="<<c<<endl <<setw(5)<<"D ="<<d<<endl <<setw(5)<<"E ="<<e<<endl ////set the field width to 5 characters. <<setw(5)<<"F ="<<f <<endl<<endl; //display. loop=1; //loop is 1, while loop passed. system("pause"); } else if( YESNO[0] == 'N' || YESNO[0] == 'n'){ //if 'N' or 'n', while loop passed. loop=1; } else{ //if neither y or n is enterred input must be incorrect. cout <<"bad answer, try again\n"; Beep (600,100); loop=0; //loop is zero, while loop continues. } } }
Thanks Houlahan.
source share