+ 3
Hey, i want to create a questionnaire using a code. Can you help me?
the questionnaire will use user input. if the user inputs very tall, for example, it must return a description. else if the user inputs short, it must return a different description. can you help me by telling me what code should I use? I think it will make everyone laugh, smile and wonder.
3 Answers
+ 4
in JavaScript : get input in var (e.g. x)
then check length property (e.g. x.length < 5 || x.length > 10).....
+ 2
create a header file in c++ and/or a class which outputs a description.
for example:
#include <iostream>
#include <very_tall.h>
using namespace std;
int main ( )
cout << you are very tall << endl
return 0;
if very tall {
very tall::very_tall. h
}
or
class very tall {
cout << you are very tall << endl
return 0;
}
if very tall {
very tall::very tall
}
+ 1
this is my c++ code~
string heights;
cout << "Wanna hear a joke??\n" << endl; //intro
cout << "If you're tall then enter 'tall' ..\n";
cout << "And if you're short then enter 'short'\n\n\n";
cin >> heights; //gets user inputs
if (heights == "short") { //a joke for tall people so that short people can laugh
cout << "\n\n\nWhat does a tall person do when they see an airplane coming? Duck." << endl; //You can use any jokes you want
cin.ignore();
cin.get();
} else if (heights == "tall") { //a joke for short people so that tall people can laugh
cout << "\n\n\nWhy do midgets always laugh when they play soccer? Because the grass tickles their balls." << endl;//You can use any jokes you want
cin.ignore();
cin.get();
} else {
cout << "Can't Recognize your height -!@#$%!#($#@amp;*)-" << endl; //outputs error when user input anything besides their height
}
cout << "\n\n\nHave a nice day!!!\n\n\n" << endl;//finish