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

     

     

     

  • 相关阅读:
    Swift如何判断上午还是下午
    Qt Creator编译app到iPhone
    用swift判断string是否包含字母
    QToolTip显示富文本问题
    mac如何发起屏幕共享?
    Redis持久化
    bean 实例化原理解析
    WebSocket和SocketIO总结
    netty入门
    redis 工具类
  • 原文地址:https://www.cnblogs.com/sharpfeng/p/5141947.html
Copyright © 2011-2022 走看看