小编mil*_*are的帖子

何时以及如何在此代码中调用 bool ?

我一直在通过 CS50 来学习编码的基础知识。我成功地制作了多个问题集 3,但我真的不明白布尔值是如何工作的。所以具体问题是:

1) boolean 的结构如何工作?2) 何时以及如何调用它?

我试图了解使用它的基本方面。谢谢你的帮助。

这是代码:

#include <cs50.h>
#include <stdio.h>
#include <string.h>

// Max number of candidates
#define MAX 9

// Candidates have name and vote count
typedef struct
{
    string name;
    int votes;
}
candidate;

// Array of candidates
candidate candidates[MAX];

// Number of candidates
int candidate_count;

// Function prototypes
bool vote(string name);
void print_winner(void);

int main(int argc, string argv[])
{
    // Check for invalid usage
    if (argc < 2)
    {
        printf("Usage: plurality [candidate ...]\n"); …
Run Code Online (Sandbox Code Playgroud)

c boolean cs50

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

标签 统计

boolean ×1

c ×1

cs50 ×1