Where to put \f?

This is that game called "Guess the magic number". I want to put \f (new page) in my code in order to prevent the next user who will try to find out the magic number from seeing my typed in number. Can i actually do it using /f? I considered that opening a new page will make the typed in magic number "invisible" to the next user. I can't figure out where to put it in order to do the "trick". I have never used \f before.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  #include <stdio.h>
int main(void)
{
	int magic;
	int guess;
	int i;
	printf("Type in the magic number: ");
	scanf_s("%d", &magic);
	guess = 0;
	for (i = 0; i < 10 && guess != magic; i++)
	{
		printf("Enter your guess: ");
		scanf_s("%d", &guess);
		if (guess == magic)
		{
			printf("RIGHT!");
			printf(" %d is the magic number.\n", magic);
		}
		else
		{
			printf("... Sorry, you're wrong...");
			if (guess > magic)
				printf(" Your guess is too high.\n");
			else printf(" Your guess is too low.\n");
		}
	}
	printf("You guessed the number after %d attempts. ", i);
	return 0;
}
Last edited on
You could print many new empty lines using a function to just go to a place of the console where it is clear

1
2
3
4
5
void clear_screen(){
for (int i=0; i<100; i++){
printf("\n");
}
}
And use the function right after the user inputs data
Topic archived. No new replies allowed.