Remake of Joke pprogram in C++
Howdy all,
Since I read the topic in software about a program that "Drian's the water out of you hard disk", I have created a C++ version of it just for hells sake, and thought that some or many of you would get a kick out of it. First I gotta say, yes it is stupid, and It's probably not post worthy.. But it is something to laugh at. So take a look and see how I did.
Here's the source code:
Since I read the topic in software about a program that "Drian's the water out of you hard disk", I have created a C++ version of it just for hells sake, and thought that some or many of you would get a kick out of it. First I gotta say, yes it is stupid, and It's probably not post worthy.. But it is something to laugh at. So take a look and see how I did.
Here's the source code:
#include <iostream> #include <unistd.h> //For sleep() #include <fstream> // ofstream #include <stdlib.h> /** srand, rand */ #include <time.h> // time #include <stdio.h> // NULL /** Need write properties */ using namespace std; void read() { // Declaring random seed srand (time(NULL)); long int write; write = rand() % 3000000 + 1; ofstream read; read.open("read.txt"); read << write << endl; read.close(); } void loading (int limit, double speed) { int i = 0; cout << "-" << flush; do { usleep(speed); cout << "\b\\" << flush; usleep(speed); cout << "\b|" << flush; usleep(speed); cout << "\b/" << flush; usleep(speed); cout << "\b-" << flush; i++; } while (i < limit); cout << endl; } /** usleep() vs sleep() function: usleep use's milisecnonds sleep use's minutes (slower).. */ int main() { int limit = 500; double speed = 4300; cout << "Water detected in System Drive"<< endl << endl << "\a"; cout << "Standbye while water is drained "; read(); loading(limit, speed); cout << endl << "Spin dry cycle starting "; loading(limit, speed); cout << endl << "System OK now... you may proceed." << endl; return 0; }
Comments
I tried SomeGuy's oldie softs, and it just blipped - virtual machine was too fast to see the actual program I guess.
I'm going to try to use freedos sometime latter today and see if I can get the source code fully compiled for you. I probably wont post it until next week as finals are looming around the corner, and time to pass my 14 units.
If you want to try this version that compiles on TC++ for dos here it is:
And the source code:
Enjoy.