+ 12
Reply yes/no.
Has your 20 line code given 21 or more errors? Reply yes/no :language you were using.
6 Respostas
+ 13
My zero line code can return 1 line error so yeah :P
+ 17
@Christopher Madi
Was it really necessary to copy my entire Magic 8-Ball code and post it here? 😐
+ 10
yes: c
+ 9
Yes, C++
+ 3
it gives me an error at the time. I don't keep track of them every time.
0
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
using namespace std;
/*
WHY?! WHY DID I NEVER THOUGHT OF DOING THIS?!
*** Magic 8-Ball is a toy used for fortune-telling or seeking advice, developed in the 1950s and manufactured by Mattel. - Wikipedia ***
Input your question and see what the Magic 8-Ball tells you!
*/
int main(int argc, char *argv[])
{
srand(time(0));
string question;
getline(cin,question);
cout << "Your question: " << question << endl << endl;
cout << "Magic 8-Ball : ";
switch(rand() % 20)
{
case 0: cout << "It is certain."; break;
case 1: cout << "It is decidedly so."; break;
case 2: cout << "Without a doubt."; break;
case 3: cout << "Yes definitely."; break;
case 4: cout << "You may rely on it."; break;
case 5: cout << "As I see it, yes."; break;
case 6: cout << "Most likely."; break;
case 7: cout << "Outlook good."; break;
case 8: cout << "Yes."; break;
case 9: cout << "Signs point to yes."; break;
case 10: cout << "Reply hazy try again."; break;
case 11: cout << "Ask again later."; break;
case 12: cout << "Better not tell you now."; break;
case 13: cout << "Cannot predict now."; break;
case 14: cout << "Concentrate and ask again."; break;
case 15: cout << "Don't count on it."; break;
case 16: cout << "My reply is no."; break;
case 17: cout << "My sources say no."; break;
case 18: cout << "Outlook not so good."; break;
case 19: cout << "Very doubtful."; break;
}
return 0;
}