小编Her*_*ein的帖子

每当我声明枚举时,它都不会编译

每当我声明一个enum,它就不会编译.我的代码看起来像这样:

private enum race {HUMAN, ORC, GOBLIN, UNDEAD}

// The name of the player
string playerName;

// The Health Points of the player. Is to be modified  a LOT. Keep that in mind!
int HP = 100;

// Made to test if the name chosen i the right one
bool nameIsRight = false;

cout("Hello fair traveler!\n\n");
cout("It has come to my knowledge, that you, a puny warrior, is up for the challenge, that is killing the dragon\n\n");

cout("Our …
Run Code Online (Sandbox Code Playgroud)

c# enums visual-studio-2012

1
推荐指数
1
解决办法
392
查看次数

MySQLi查询失败,没有错误代码

我一直在一个名为FreeHostia的免费托管网站上进行一些网络开发测试.我一直在尝试通过PHP创建数据库.然而,我的努力是徒劳的.查询失败,我没有错误代码.我的PHP代码如下所示:

<?php 
    // Create connection
    $con=mysql_connect("localhost", "raslar10_players", "123456", "raslar10_players");

    if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    } else {
        echo "Connected to MySQL";
    }

    // Create table
    $sql = "CREATE TABLE Persons(FirstName CHAR(30),LastName CHAR(30),Age INT)";

    if (mysqli_query($con, $sql)) {
        echo "Table persons created successfully";
    } else {
        echo "Error creating table: " . mysqli_error($con);
    }

    ?>
Run Code Online (Sandbox Code Playgroud)

我做错了什么?该查询在phpMyAdmin中工作,并且连接正在运行.(根据我的代码,反正)

php mysql mysqli

0
推荐指数
1
解决办法
150
查看次数

Method认为它是一个构造函数

我正在关注"游戏开发者数学"YouTube系列.代码工作没有问题,直到我在Vector类中定义了一个Length()方法,如下所示:

class Vector
    {
        public const float Length()
        {
            float length;

            length = Math.Sqrt(x*x + y*y);

            return length;
        }

        public float x, y;
    } 
Run Code Online (Sandbox Code Playgroud)

你们其中一个人能否找到我做错了什么.其余的代码被遗漏了,因为它是不相关的,据我所知.

c# visual-studio

-1
推荐指数
1
解决办法
102
查看次数

标签 统计

c# ×2

enums ×1

mysql ×1

mysqli ×1

php ×1

visual-studio ×1

visual-studio-2012 ×1