C++程序设计答案(机械工业出版社)Y.Daniel L一到三章答案

更新时间:2023-06-13 12:00:37 阅读: 评论:0

Exerci1_2
bonobo#include <iostream>
using namespace std;
int main()
{
  cout << "Welcome to Java" << endl;
  cout << "Welcome to C++" << endl;
  cout << "Enjoy Programming" << endl;
  return 0;
}
Exerci2_2
#include <iostream>
using namespace std;
int main()
{
  cout << "Enter the radius and length of a cylinder: ";
  double radius, length;
  cin >> radius >> length;
  double area = radius * radius * 3.14159;
  double volume = area * length;
  cout << "The area is " << area << endl;
  cout << "The volume is " << volume << endl;
  return 0;
}
Exerci2_4
#include <iostream>
using namespace std;
int main()
{
  cout << "Enter a number in pounds: ";
  double pounds;
  cin >> pounds;
  double kilograms = pounds * 0.454;
  cout << "The kilograms is " << kilograms << endl;
考研政治真题
  return 0;
}
Exerci2_6
#include <iostream>
using namespace std;
int main()
{
  cout << "Enter a number between 0 and 1000: ";
  int number;
  cin >> number;
  int lastDigit = number % 10;
  number = number / 10;
  int condLastDigit = number % 10;
  number = number / 10;
  int thirdLastDigit = number % 10;
  number = number / 10;
  int sumOfDigits = lastDigit + condLastDigit + thirdLastDigit;
  cout << "The sum of the digits is " << sumOfDigits << endl;
  return 0;
}
Exerci2_8
#include <iostream>
using namespace std;
int main()
{
  cout << "Enter an ASCII code: ";
  int code;
  cin >> code;
  char ch = code;
  cout << "The character is " << ch << endl;
  return 0;
}
Exerci2_10
#include <iostream>
using namespace std;
int main()
{
  // Receive the amount
  cout << "Enter balance and interest rate (e.g., 3 for 3%): ";
  double balance, annualInterestRate;
  cin >> balance >> annualInterestRate;
  double interest = balance * (annualInterestRate / 1200);
  // Display results
  cout << "The interest rate is " << balance << endl;
  cout << "The balance is " << balance << endl;
  cout << "The interest is " << interest << endl;
}儿童英语学习
Exerci2_12
#include <iostream>
using namespace std;
int main()
{
  double monthlyDeposit = 100;
  double currentValue = monthlyDeposit;
  // First month value
  currentValue = currentValue * (1 + 0.05 / 12);
  cout << "After the first month, the account value is " << currentValue << endl;
  // Second month value
  currentValue = (currentValue + monthlyDeposit) * (1 + 0.05 / 12);
  cout << "After the cond month, the account value is " << currentValue << endl;
  // Third month value
  currentValue = (currentValue + monthlyDeposit) * (1 + 0.05 / 12);
  cout << "After the third month, the account value is " << currentValue << endl;
  // Fourth month value
  currentValue = (currentValue + monthlyDeposit) * (1 + 0.05 / 12);
  // Fifth month value
  currentValue = (currentValue + monthlyDeposit) * (1 + 0.05 / 12);
  // Sixth month value
  currentValue = (currentValue + monthlyDeposit) * (1 + 0.05 / 12);
  cout << "After the sixth month, the account value is " << currentValue << endl;
  return 0;
}
Exerci3_2
#include <iostream>
using namespace std;
youk
int main()
{
  cout << "Enter an integer: ";
  int value;
  cin >> value;
  bool isEven = value %2 == 0;
  // Display results
  cout << "Is " << value << " an even number? ";
  if (isEven)
    cout << "true" << endl;
  el
    cout << "fal" << endl;
}
Exerci3_4
#include <iostream>
无形资产包括哪些
using namespace std;
int main()
经营范围英文{
  // Receive the amount
  cout << "Enter an amount in double, for example 11.56: ";
  double amount;esnce什么意思
  cin >> amount;
  int remainingAmount = static_cast < int > (amount * 100);
  // Find the number of one dollars
  int numberOfOneDollars = remainingAmount / 100;
  remainingAmount = remainingAmount % 100;
  // Find the number of quarters in the remaining amount
  int numberOfQuarters = remainingAmount / 25;
  remainingAmount = remainingAmount % 25;
凯特温斯莱特老公  // Find the number of dimes in the remaining amount
  int numberOfDimes = remainingAmount / 10;
新东方在线课堂  remainingAmount = remainingAmount % 10;
  // Find the number of nickels in the remaining amount
teva  int numberOfNickels = remainingAmount / 5;
  remainingAmount = remainingAmount % 5;
  // Find the number of pennies in the remaining amount
  int numberOfPennies = remainingAmount;
  // Display results
  cout << "Your amount " << amount << " consists of \n";
  if (numberOfOneDollars > 1)

本文发布于:2023-06-13 12:00:37,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/143560.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:考研   真题   政治
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图