Sorry for unclear topic. The thing what i'm trying to do is, i have a sentence and i want to print it but after 1st letter, the 2nd letter must wait for a 1 second. and after the printing 2nd letter program should display it after waiting another second. actually i would add this to the start of another self-study project(bank system)
i have tryed couple of times and none of them didn't worked. here is what i have lately:
#include <cstdlib>
#include <iostream>
usingnamespace std;
int main(void)
{
char sentence[45]="TimurBank Customer Account Management System";
int i; // timer counter
int idx=(-1); // letter position
int modres; // modulus operation result
modres = i%5000;
// i assume looping from 0 to 5000 as 1 second as time, but i may be wrong
for (i=0; i<=225000; i++){ // 225000 = 45*5000
while (modres == 0){
idx=idx+1;
cout<<sentence[idx];
}
}
return (0);
}
i will be appriciate to all kind of suggestions and helps.
Regards,
Timur
*ps: i don't know if it makes any difference, but i use netbeans on ubuntu. just for info
sleep - Sleep for the specified number of seconds
Synopsis
#include <unistd.h>
unsignedint sleep(unsignedint seconds);
Description
sleep() makes the current process sleep until seconds seconds have elapsed or a signal arrives which is not ignored.
Return Value
Zero if the requested time has elapsed, or the number of seconds left to sleep.
Conforming to
POSIX.1-2001.