C++入门经典第一章编程项目

1.

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
    int a, b;
    cout << "请输入两个任意整数:\n";
    cin >> a >> b;
    cout << "两者和为:" << a + b << "\n";
    cout << "两者积为:" << a * b << "\n";
    cout << "这是程序结尾\n";
}

2.

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
    cout << "************************************************************\n\n";
    cout << "      ccc        sss    !!\n";
    cout << "     c   c      s       !!\n";
    cout << "    c            sss    !!\n";
    cout << "     c   c          s       !!\n";
    cout << "        cc         sss    0 0 \n";
    cout << "\n";
    cout << "************************************************************\n";
    cout << "成功完成!!!";
}

3.

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
    int a, b, c;
    cout << "请输入25美分硬币数:\n";
    cin >> a;
    cout << "请输入10美分硬币数:\n";
    cin >> b;
    cout << "请输入5美分硬币数:\n";
    cin >> c;
    cout << "一共是:" << a * 25 + b * 10 + c * 5 << "美分\n";
}

4.

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
    int  t;
    double g,h;
    g = 9.8;
    cout << "请输入坠落时间:\n";
    cin >> t;
    h = g * t*t;
    cout << "自由落体距离是:\n"<<h/2;
}

5.

#include "pch.h"
#include <iostream>
using namespace std;

int main()
{
    char X;
    cout << "请输入字母:\n";
    cin >> X;
    cout << X << X << X << X;
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值