XeniX
Power Member
Boas!
Fiz um programa em c++.
Depois de feito o programa, eu fui à pasta do projecto e criei um arquivo .rar com o .exe do programa para enviar pelo messenger a amigos.
O problema é que eles não conseguem executar o programa. Mas no meu pc funciona!
É capaz de ser uma questão trivial, mas já googlei e não encontrei nada.
Se precisarem do código:
Já agora: se me explicassem a função agradecia. Copiei-a da net mas não a percebo na totalidade :
Agradecimentos avançados!!
Fiz um programa em c++.
Depois de feito o programa, eu fui à pasta do projecto e criei um arquivo .rar com o .exe do programa para enviar pelo messenger a amigos.
O problema é que eles não conseguem executar o programa. Mas no meu pc funciona!
É capaz de ser uma questão trivial, mas já googlei e não encontrei nada.
Se precisarem do código:
Código:
#include <iostream>
#include <time.h>
using namespace std;
/*************************
* Guideline *
* *
* for this game we will *
* use this set of numbers*
* a=7 b=9 c=3 *
* the result is 21 *
*************************/
int main()
{
char chooseYN;
int a;
int b;
int c;
int CodeNumber=(a*b)/c;
time_t start_time, cur_time;
time(&start_time);
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<"Please insert the secret code:";
cout<<"**"<<endl;
cout<<endl;
cout<<"Hi! I guess it's your first time here! (press enter to proceed)"<<endl;
cin.get();
cout<<"Can you discover the secret code of this program, and unveil the secret information it contains? (type 'y' or 'n' to proceed)"<<endl;
cin>>chooseYN;
if(chooseYN=='y'||chooseYN=='Y') {
cout<<"Ok! Let's proceed then! (press enter to proceed)"<<endl;
cin.get();
cout<<"To find this code you'll need to be aware of the rules:"<<endl;
cin.get();
cout<<"\t1-The code is composed by a positive integer number of 2 algarisms"<<endl;
cin.get();
cout<<"\t2-The code number is the result of the product of two numbers (a,b) divided by a third (c)"<<endl;
cin.get();
cout<<"\t3-Numbers 'a', 'b' and 'c' are constituted by one algarism, different than zero,\l and smaller than 10"<<endl;
cin.get();
cout<<"\t4-The code number is odd"<<endl;
cin.get();
cout<<"This is it! Press enter when you feel ready!"<<endl;
cin.get();
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<"Please insert the secret code:"<<endl;
cout<<"Step 1: insert 'a':";
cin>>a;
cout<<endl<<"Step 1: insert 'b':";
cin>>b;
cout<<endl<<"Step 1: insert 'c':";
cin>>c;
if (CodeNumber!=21) {
cout<<"Analysing information... Pease wait..."<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Verifying constant 'a'"<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Verifying constant 'b'"<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Verifying constant 'c'"<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Computing..."<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 4);
cout<<"Access denied"<<endl;
return 0;
}
else if (CodeNumber==21) {
cout<<"Analysing information... Pease wait..."<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Verifying constant 'a'"<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Verifying constant 'b'"<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Verifying constant 'c'"<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
cout<<"Computing..."<<endl;
do {
time(&cur_time);
}
while((cur_time - start_time) < 4);
cout<<"Access granted"<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"***************************************"<<endl;
cout<<"* N. S. A. *"<<endl;
cout<<"* National Security Agency *"<<endl;
cout<<"***************************************"<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"You've been fooled! Sorry! :P Press enter to exit this bloody program";
cin.get();
return 0;
}
else {
return 0;
}
}}
Já agora: se me explicassem a função agradecia. Copiei-a da net mas não a percebo na totalidade :
Código:
time_t start_time, cur_time;
time(&start_time);
do {
time(&cur_time);
}
while((cur_time - start_time) < 1);
Agradecimentos avançados!!