Menu
CoddyTech

练习 #2

Coddy C/C++ 结构体 课程的第 7 课,共 8 课。

challenge icon

挑战

简单

给你一些代码,请创建一个 Contact 结构体,使其与其余代码相匹配。

亲手试试

#include <stdio.h>

// 在这里定义结构体

int main() {
    struct Contact contact1 = {"John Doe", "123-456-7890", "john@example.com"};
    struct Contact contact2 = {"Alice Smith", "456-789-0123", "alice@example.com"};
    struct Contact contact3 = {"Bob Johnson", "789-012-3456", "bob@example.com"};
    
    printf("%s %s %s\n", contact1.name, contact1.phoneNumber, contact1.email);
    printf("%s %s %s\n", contact2.name, contact2.phoneNumber, contact2.email);
    printf("%s %s %s\n", contact3.name, contact3.phoneNumber, contact3.email);

    return 0;
}

C/C++ 结构体中的所有课

自己练习: C 在线编译器