well in a program i m making i need a loading screen it wont be doing anything its just a prank thing im doing
but i need like it to sit and look as if its loading for half a minute
can anyone help
im in the dos box still
on c++

can anyone help me

Recommended Answers

All 7 Replies

just display a message, such as

cout << "Please wait while loading or press a key to exit ...";
while(1)
   ;

well i want it to look like have a percent screen going one to 100 perceant

Ok, so add some print statements inside the loop I posted. Use the win32 api function Sleep() to delay the program between print statements. You can't show graphics uniess you want to write a win32 api windows program, but that's not a console program.

well i had a program a friend gave me before it was in the dos box but it woul load 1 to 100 percent just the numbers would change

int load = 0;
while (load < 100)
load++;
cout << "loading" << load << endl;

this may go fast make another int eg int count = 0; if count = 1000 do the stuff then it will = 0. else count++;

well i had a program a friend gave me before it was in the dos box but it woul load 1 to 100 percent just the numbers would change

It's done this way

for(int i = 0; i < 100; i++)
{
   cout << "\r" << i ;
   Sleep(1000); // delay 1 second
}

oh yeah, havent been using console for a while, havent been using sleep

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.