-
Pausing a loop
Very new to programming and I am trying to get a program to retrieve a file and number it if it has more than 24 lines of info it should stop until prompted by the user. I know it needs a loop but how do I retain the numbers i.e. 1-24 then 25-49.....
-
in case you don't know what '%' means, it is modulus, and it returns the remainder of the division of two numbers
so this means the remainder of linenum divided by 24 will be 0 every 24 lines
47 / 24 = 1.958; //has a remainder of .958 so it doesnt work
48 / 24 = 2; //has no remainder so it works, yay!
-
The remainder and the decimal part of the quotient aren't equivalent.
The remainder is an integer.
-
The remainder of 47 / 24 is 23
-
-
no
Its just 23. I dont know where you got .4 from. Could you explain?
-
Code:
if(wherey()%24==0)
{
cout<<"Press a key..."; getch();
}
//continue execution.
Include conio.h and iostream.h
Compiler : Turbo C++ v1.01.