Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <ctime>
- bool** genmat(){
- bool** test=new bool*[10];
- for(int i=0;i<10;++i){
- test[i]=new bool[4];
- }
- return test;
- }
- void assmat(bool** mat){
- for(int i=0;i<10;++i){
- for(int j=0;j<4;++j){
- mat[i][j]=false;
- }
- }
- }
- void genrispcorr(bool** mat){
- for(int i=0;i<10;++i){
- int a=rand()%3;
- mat[i][a]=true;
- }
- }
- void genrispconc(bool** mat, int o){
- int somma=0;
- std::cout<<"Quiz concorrente "<<o<<"\t"<<std::endl;
- for(int i=0;i<10;++i){
- int k=0;
- int a=rand()%3;
- if(mat[i][a]==true){
- k=3;
- std::cout<<"Risposta corretta: 3 punti"<<std::endl;
- }
- else{
- k=-1;
- std::cout<<"Risposta errata: -1 punto"<<std::endl;
- }
- somma+=k;
- }
- std::cout<<"Punteggio totale: "<<somma<<"\t\t"<<std::endl;
- }
- int main(){
- for(int i=0;i<7;++i){
- bool** test=genmat();
- assmat(test);
- srand(time(NULL));
- genrispcorr(test);
- genrispconc(test,i);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement