I'm using this function to get the values for a primitive "graphing calculator". The problem lies in the printing of the function afterwards. I'm using a window(60,1,80,30) in textmode C80. But when i use the \n's it just goes back to the left side of the screen. What can I use to make it stay within the left limit of 60?
Code:void GetMnB() { //clrscr(); gotoxy(2,2); cout << "f(x)=y=Ax^3+Bx^2+Cx+D"; gotoxy(2,4); cout << "A: "; cin >> a; delline(); //gotoxy(2,2); cout << "B: "; cin >> b; delline(); //gotoxy(2,1); cout << "C: "; cin >> c; delline(); //gotoxy(2,0); cout << "D: "; cin >> d; delline(); //Got the Info, Printing out the Function... gotoxy(2,2); delline(); if(c!=0) printf("%fx^3 ",a); if(b<0) printf("\n%f^2",b); else if(b>0) printf("\n+%f^2",b); if(c<0) printf("\n%fx",c); else if(c>0) printf("\n+%fx",c); if(d<0) printf("\n%f",d); else if(d>0) printf("\n+%f",d); }



LinkBack URL
About LinkBacks


