0

Write a story script :) [ meaning user can input value and it would change where the story is going]

11th Dec 2016, 4:38 AM
Yongkang_lin
2 ответов
+ 5
print("press 1 to die. press 2 to live") value=input() if value == "1": print("you die a glorious death") elif value == "2": print("you take over the world, billions dying at your hands. was it worth it?") #this is python
11th Dec 2016, 5:27 AM
Ahri Fox
Ahri Fox - avatar
+ 1
I will translate @Ahri Fox's Python code to c++ ..simple.. void story(int x) { if (x == 1) { cout << "You died protecting"; cout << " your girlfriend from "; cout << " being raped.." << endl; } else if (x == 2) { cout << "You live with your"; cout << " girlfriend's chopped"; cout << " head.." << endl; } else { cout << "ERROR" << endl; } } int main() { int input; cout << "Enter number 1 or 2" << endl; cin >> input; story(input); return 0; } totally the same as @Ahri Fox's code with different output.. :)
11th Dec 2016, 4:21 PM
Fluffy Rabbit
Fluffy Rabbit - avatar