In C++, what will the program print? Sum all the printed fractions, then add the numerator and denominator of the resulting (simplified) fraction, then square the sum.

#include <iostream>#include <string>usingnamespacestd;structcharacter{stringname;inthitPoints;intmaxHitPoints;};voidharmCharacter(charactercharacterToHarm,inthealth){characterToHarm.hitPoints-=health;if(characterToHarm.hitPoints<0){characterToHarm.hitPoints=0;}}voidhealCharacter(charactercharacterToHeal,inthealth){characterToHeal.hitPoints+=health;if(characterToHeal.hitPoints>characterToHeal.maxHitPoints){characterToHeal.hitPoints=characterToHeal.maxHitPoints;}}intmain(){characterplayer={"Col. Mustard",10,15};cout<<player.hitPoints<<"/"<<player.maxHitPoints<<endl;harmCharacter(player,7);cout<<player.hitPoints<<"/"<<player.maxHitPoints<<endl;healCharacter(player,16);cout<<player.hitPoints<<"/"<<player.maxHitPoints<<endl;harmCharacter(player,4);cout<<player.hitPoints<<"/"<<player.maxHitPoints<<endl;healCharacter(player,1);cout<<player.hitPoints<<"/"<<player.maxHitPoints<<endl;cout<<"Col. Mustard SUCKS!!! Professor Plum and Miss Scarlet are SO MUCH BETTER!!!!!"<<endl;cout<<endl;cout<<endl;return0;}

Excel in math and science

Master concepts by solving fun, challenging problems.

It's hard to learn from lectures and videos

Learn more effectively through short, conceptual quizzes.

Our wiki is made for math and science

Master advanced concepts through explanations,
examples, and problems from the community.

Used and loved by 4 million people

Learn from a vibrant community of students and enthusiasts,
including olympiad champions, researchers, and professionals.

Your answer seems reasonable.
Find out if you're right!