我正在监督一个技术营地,其中一个营员为一个基于文本的视频游戏创建了一些代码,他无法显示结果.当程序编译并正确运行时,当选择"治疗"时它不会增加玩家的健康状况,当用户选择"攻击"时我们也会得到零.我对编程知识有限,并且我尽力帮助他,以便他在这里的经历将是愉快和充实的.如果您能提供任何帮助或建议,我们将非常感激.这是代码:
// Test for hard stuff.cpp : Defines the entry point for the console application.
//
// Bigger proj
// Constructors will make characters with rolling statistics
#include "stdafx.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
// declaring function for hit power
//int power( int str, int def);
int command;
class character
{
public:
character();
//~character();
string name;
float str;
float def;
float health; // hit points
float regen; // health regen amount
float …
Run Code Online (Sandbox Code Playgroud)