• 2019年3月6日 CPP


    实验一:

    C++的一些基本输入

    实验二:

    用C++判断一个数是不是素数

    实验三:

    求一个数字分解成每一位数字的和

    模拟银行账户(写得比较傻)

    //#include<iostream>
    //using namespace std;
    //void main()
    //{
    //	char name[20];
    //	int age;
    //	cout << "What is your name and age?" << endl;
    //	cin >> name >> age;
    //	cout << "Hello " << name << "." << endl<< "Your age is " << age<<endl;
    //}
    //
    //#include<iostream>
    //using namespace std;
    //
    //bool isprime(int n) {
    //	bool flag = 1;
    //	if (n == 2)	return flag;
    //	else if (n % 2 == 0 || n == 1)	return 0;
    //	else {
    //		for (int i = 3; i < sqrt(n); i += 2) {
    //			if (n % i == 0) return 0;
    //		}
    //		return 1;
    //	}
    //}
    //int main()
    //{
    //	cout << "请输入一个数" << endl;
    //	int num;
    //	cin >> num;
    //	if(isprime(num))	cout << "这个数是素数" << endl;
    //	else cout << "这个数不是素数" << endl;
    //}
    
    //#include<iostream>
    //using namespace std;
    //int main()
    //{
    //	char a[100];
    //	gets_s(a);
    //	int sum = 0;
    //	for (int i = 0; i < strlen(a); i++)
    //		sum += a[i] - '0';
    //	cout << sum << endl;
    //	
    //}
    
    
    #include<iostream>
    using namespace std;
    int main()
    {
    	int account , password;
    	cout << "请输入账号:" << endl;
    	cin >> account;
    	cout << "请输入密码:" << endl;
    	cin >> password;
    	if (account == 123 && password == 123456)	cout << "登陆成功" << endl;
    	else cout << "登陆失败";
    }
    
    作者:LightAc
    出处:https://www.cnblogs.com/lightac/
    联系:
    Email: dzz@stu.ouc.edu.cn
    QQ: 1171613053
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。
  • 相关阅读:
    23 数字时钟&长图滚动
    22 日期特效&长图滚动
    彻底澄清c/c++指针概念
    已管理员模式运行批处理路径丢失问题的解决方法
    使用mathjax在博客中完美显示数学公式,支持PC,手机浏览器
    GOOGLE高级搜索技巧
    我要搬家
    简单的3proxy配置
    AutoMapper小结
    专业IT培训机构-传智播客
  • 原文地址:https://www.cnblogs.com/lightac/p/10534740.html
Copyright © 2020-2023  润新知