Each time you press "enter" display the following n-values ​​of the table after them the inscription "press" enter "", press "enter" the inscription disappears the table is displayed further by n values, and if you scroll through it to the previous n-values, then the words "click" enter "" no enter image description here

#include <stdlib.h> #include <stdio.h> int main(void) { unsigned int N; int variant,i,n; double x1,x2,delta,y,x; do { printf("Vyberit' variant obchyslennja funktsii f(x)\n"); printf("1 - za tochkamy; 2 - za krokom zminy\n"); scanf("%d",&variant); if(variant==1) { printf("Vy vybraly variant: %d\n", variant); printf("Vvedit' N, x1, x2\n"); scanf("%d%lf%lf",&N,&x1,&x2); printf("x1=%.2f x2=%.2f N=%d\n",x1,x2,N); getch(); printf("-------------------------------------------------------------------------------------------------\n"); printf("| N |\t\t\t X \t\t\t|\t\t\tF(X) \t\t\t|\n"); delta=(x2-x1)/N; for(x=x1,n=1,i=0;x<x2,n<N,i<N;x=x+delta,n++,i++) { y=(x*x*x)-3*(x*x)+4; printf("-------------------------------------------------------------------------------------------------\n"); printf("| %2d |\t\t\t%5.2f \t\t|\t\t %6.2f\t\t\t|\n",n,x,y); if((i+1)% 10 == 0) { printf("Press any key...\n"); getch(); } } printf("-------------------------------------------------------------------------------------------------\n"); } else if(variant==2) \\ не доделано { printf("Vy vybraly variant: %d", variant); } else { printf("Vash vybir ne vidpovidae vymogam!\n"); } } while ((variant!=1)&&(variant!=2)); getch(); } 
  • show the code .... - Valera Kvip
  • Depending on the properties of your terminal, printf("\b\b\b\b") can help you (for example, as many characters \b as in the text Press any key... Just remove \n from printf("Press any key...\n"); ;. - VladD
  • already corrected, thanks! - Ruslan Suprun

1 answer 1

I don't remember C very well, but can it be so?

  if((i+1)% 10 == 0) { printf("Press any key..."); getch(); printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"); } 
  • Already tried this option, does not work ( - Ruslan Suprun
  • one
    @RuslanSuprun: Did you remember to remove \n from the first printf ? - VladD