zoukankan      html  css  js  c++  java
  • 01-用链式结构打印学生成绩单

    用链式结构打印学生成绩单

     

    #include <iostream>

    using namespace std;

     

    struct StScore

    {

        std::string id;

        int math;

        int english;

        int computer;

        struct StScore* next;

    };

     

    int main()

    {

        StScore first;

        first.id = "C";

        first.math = 80;

        first.english = 85;

        first.computer = 83;

        first.next = nullptr;

     

        StScore second;

        second.id = "A";

        second.math = 75;

        second.english = 91;

        second.computer = 88;

        second.next = nullptr;

        first.next = &second;

        cout<<"id math english computer"<<endl;

        StScore* pNode = &first;

        while (pNode != nullptr)

        {

            cout<<pNode->id<<" "

                <<pNode->math<<" "

                <<pNode->english<<" "

                <<pNode->computer

                <<endl;

            pNode = pNode->next;

        }

        return 0;

    }

     

    结果:

    id math english computer

    C 80 85 83

    A 75 91 88

    Program ended with exit code: 0

     

     

     

  • 相关阅读:
    Raft协议备注
    领域建模笔记
    Spark编程模型
    Spark如何删除无效rdd checkpoint
    Parquet 列式存储格式
    SpringBoot中ConditionalOnClass注解的原理
    SpringBoot定制Sevlet容器原理
    分析JDK的动态代理原理
    简述SpringCloud底层原理
    简述SpringCloud框架
  • 原文地址:https://www.cnblogs.com/sharpfeng/p/5141947.html
Copyright © 2011-2022 走看看