Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <sstream>
- #include <fstream>
- using namespace std;
- int main()
- {
- system("COLOR FC");
- cout <<"\n=====================================================\n";
- cout <<"\nVersion 1.0\n";
- cout <<"\nSelecteaza Optiunea\n";
- cout <<"1. Inchide PC dupa Timer \n";
- cout <<"2. Restart \n";
- cout <<"3. Anuleaza Oprirea \n";
- cout <<"4. Scrie in fisier \n";
- cout <<"5. Read \n";
- cout <<"\n=====================================================\n";
- getch();
- bool run = true;
- while (run)
- {
- int liOption;
- cin>>liOption;
- switch( liOption )
- {
- case 1:
- {
- int liMinute;
- cout << "[ SHUTDOWN ] Introdu minutele: ";
- cin>>liMinute;
- if ( liMinute <= 0 || liMinute >= 1000 )
- {
- cout << "[ EROARE ] Introdu o valoare de la 1-999 minute.\n" << endl;
- break;
- }
- int secunde = liMinute * 60;
- cout << "[ SHUTDOWN ] In " << liMinute << " minute ( " << secunde << " secunde ) se inchide calculatorul.\n";
- stringstream ss;
- ss << "shutdown -s -t " << liMinute * 60;
- system( ss.str().c_str() );
- break;
- }
- case 2:
- {
- system("restart.exe");
- cout << "[ RESTART ] Restartarea incepe..\n" ;
- break;
- }
- case 3:
- {
- system("shutdown.exe -a");
- cout << "[ SHUTDOWN ] Oprirea a fost anulata.\n" ;
- break;
- }
- case 4:
- {
- string text;
- cout << "Introdu textu: " ;
- cin>>text;
- ofstream myfile ( "Notes.txt", ios_base::app);
- myfile << text << "\n";
- myfile.close();
- break;
- }
- case 5:
- {
- cout <<"\n====================== [ Notes ] ======================\n";
- string Rows;
- ifstream MyFile ( "Notes.txt" );
- if ( MyFile.is_open() )
- {
- while ( getline( MyFile, Rows ) )
- {
- cout << Rows << '\n';
- }
- MyFile.close();
- }
- else cout << "Fisierul cu notite este gol.";
- cout <<"\n========================================================\n";
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement