zoukankan      html  css  js  c++  java
  • 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
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。
  • 相关阅读:
    http协议
    三次握手四次挥手的原理
    mmap
    I/O多路复用之poll
    I/O多路转接之select
    自旋锁、文件锁、大内核锁
    网络基础(一)
    线程同步之(信号量)
    进程与线程的简单理解
    内存溢出——程序员必备网站
  • 原文地址:https://www.cnblogs.com/lightac/p/10534740.html
Copyright © 2011-2022 走看看