ConteD

Domanda e risposta con scarto

Sep 14th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     string risposte[10]={"Si.","Vabene.","Forse.","No.","Non ricordo.","Non mi va di risponderti","Ma anche no","Zitto","Non so","Può darsi"};
  10.     srand(time(NULL));
  11.     string domanda;
  12.     int i2;
  13.    
  14.     for(int i=0; i<10; i++)
  15.     {
  16.     cout<<"Fammi una domanda!\n";
  17.     getline(cin, domanda);
  18.         do{
  19.         i2=rand()%10;
  20.         }while(risposte[i2][1]==1);
  21.    
  22.     cout<<risposte[i2]<<endl<<endl;
  23.     risposte[i2][1]=1;
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment