+ 2

What is output this code by Nazik;)

#include <iostream> using namespace std; int y = 1; int z = 2; int q = 3; int c = 4; int x = 3; string a ="Attack is 50xp"; string p ="Power is 100xp"; string h ="Health is 900xp"; string s ="Superpower is 900xp"; class Ninja{ public: void Attack() { cout << a; } public: void Power() { cout << p; } public: void Health { cout << h; } public: void Superpower(){ cout << s; } }; int main() {; return 0; }

8th Jan 2018, 2:10 PM
Назік Демчук
Назік Демчук - avatar
2 odpowiedzi
+ 3
Output: No output. as no object is created.
8th Jan 2018, 2:23 PM
Tapas Mondal
Tapas Mondal - avatar
+ 1
Correct code is here: #include <iostream> using namespace std; int y = 1; int z = 2; int q = 3; int c = 4; int x = 3; string a ="Attack is 50xp"; string p ="Power is 100xp"; string h ="Health is 900xp"; string s ="Superpower is 900xp"; class Ninja{ public: void Attack() { cout << a; } public: void Power() { cout << p; } public: void Health() { cout << h; } public: void Superpower(){ cout << s; } }; int main() { return 0; }
8th Jan 2018, 2:23 PM
Tapas Mondal
Tapas Mondal - avatar