⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prog2_02.cpp

📁 c++经典理论课程源文件程序.第二部分源程序
💻 CPP
字号:
// Program 2.2 - Working with integer variables
#include <iostream>              // For output to the screen
using std::cout;
using std::endl;

int main() {  
  int apples = 10;             // Definition for the variable apples
  int children = 3;            // Definition for the variable children

  // Calculate fruit per child
  cout << endl                   // Start on a new line
       << "Each child gets "     // Output some text
       << apples/children        // Output number of apples per child
       << " fruit.";             // Output some more text

  // Calculate number left over
  cout << endl                   // Start on a new line
       << "We have "             // Output some text
       << apples % children      // Output apples left over
       << " left over.";         // Output some more text

  cout << endl;
  return 0;                      // End the program
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -