<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # C++ 程序:在結構中存儲學生的信息 > 原文: [https://www.programiz.com/cpp-programming/examples/structure-store-information](https://www.programiz.com/cpp-programming/examples/structure-store-information) #### 該程序將學生的信息(用戶輸入的姓名,名次和分數)存儲在結構中,并將其顯示在屏幕上。 要理解此示例,您應該了解以下 [C++ 編程](/cpp-programming "C++ tutorial")主題: * [C++ 結構](/cpp-programming/structure) * [C++ 字符串](/cpp-programming/strings) * * * 在此程序中,將創建一個結構(學生),其中包含名稱,名冊和標記作為其數據成員。 然后,創建一個或多個結構變量。 然后,從用戶獲取數據(名稱,名次和標記)并將其存儲在結構變量`s`的數據成員中。 最后,顯示用戶輸入的數據。 * * * ## 示例:使用結構存儲和顯示信息 ```cpp #include <iostream> using namespace std; struct student { char name[50]; int roll; float marks; }; int main() { student s; cout << "Enter information," << endl; cout << "Enter name: "; cin >> s.name; cout << "Enter roll number: "; cin >> s.roll; cout << "Enter marks: "; cin >> s.marks; cout << "\nDisplaying Information," << endl; cout << "Name: " << s.name << endl; cout << "Roll: " << s.roll << endl; cout << "Marks: " << s.marks << endl; return 0; } ``` **輸出** ```cpp Enter information, Enter name: Bill Enter roll number: 4 Enter marks: 55.6 Displaying Information, Name: Bill Roll: 4 Marks: 55.6 ``` 在該程序中,創建了`student`(結構)。 該結構具有三個成員:`name`(字符串),`roll`(整數)和`marks`(浮點)。 然后,創建結構變量`s`來存儲信息并將其顯示在屏幕上。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看