il mio (in c++)fa un po' schifo...anche perchè non ho capito cosa significava '+' :ipezziassurdi:....
per questo esercizio ho preso spunto dalla discussione di opocaj--> http://www.infernet-x.com/python/hq9-interpreter-t-13311.html
per questo esercizio ho preso spunto dalla discussione di opocaj--> http://www.infernet-x.com/python/hq9-interpreter-t-13311.html
Codice:
#include <iostream>
using namespace std;
int main()
{
int z;
char x[z];
cout << ">>";
gets(x);
for (int y=0; y<strlen(x); y++) {
if ((x[y]=='h') || (x[y]=='H')) cout << "Hello World!\n";
if ((x[y]=='q') || (x[y]=='Q')) cout << x << endl;
if ((x[y]=='9'){
for(int t=99; t>=0;){
cout << t << "bottles of beer\nyou take ";
if (t>0) cout << "one ";
else cout << "it ";
cout <<"down, pass it around,\n";
if (t>0) cout << --t ;
else cout << "no more ";
cout << "bottles of beer on the wall.\n\n";}}
}
return 0;
}