自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

GOOD LUCK

GOOD LUCK

  • 博客(12)
  • 资源 (1)
  • 收藏
  • 关注

原创 11.C++类和对象程序举例-钟表类

#include <iostream>using namespace std;class Clock { public: void setTime(int newH=0,int newM=0,int newS=0); void showTime(); private: int hour,minute,second;};//成员函数的实现void Clock::setTime(int newH,int newM,int newS) { hour=newH; min.

2020-10-31 21:58:43 408

原创 10.C++8位二进制转十进制

#include <iostream> using namespace std;//计算x的n次方double power(double x,int n);int main(){ int value=0; cout<<"Enter the 8 bit binary number:"<<endl; for(int i=7;i>=0;i--){ char ch; cin>>ch; if(ch=='1'){ value+=s.

2020-10-31 12:10:03 613

原创 9.C++例2-10 输入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束。

//例2-10 输入一系列整数,统计出正整数个数i和负整数个数j,读入0则结束。#include <iostream>using namespace std;int main() { int i=0,j=0,n; cout<<"Enter some integers please (enter 0 to quit):"<<endl; cin>>n; while(n!=0) { if(n>0) i += 1; if(n<0) .

2020-10-29 23:24:05 1478 1

原创 8.C++例2-8:输入一个整数,求出它的所有因子

//例2-8:输入一个整数,求出它的所有因子#include <iostream>using namespace std;int main() { int n; cout<<"Enter a postive integer"<<endl; cin>>n; cout << "Number " << n << " Factors :"; for(int k=1; k<=n; k++) { if.

2020-10-29 23:01:06 3474 2

原创 7.C++例2-4:输入一个0~6的整数,转换成星期输出

#include <iostream>using namespace std;int main() { int day; cin>>day; switch(day) { case 0: cout<<"Sunday"<<endl; break; case 1: cout << "Monday" << endl; break; case 2: cout << "Tuesda.

2020-10-29 22:28:00 2521

原创 6.C++例2-3:输入两个整数,比较两个数的大小

#include <iostream>using namespace std;int main(){ int x,y; cout<<"input x and y"<<endl; cin>>x>>y; if(x!=y) { if(x>y){ cout<<"x>y"<<endl; } else{ cout<<"x<y"<<endl; } ...

2020-10-29 21:45:59 4828

原创 5.C++例2-2输入一个年份,判断是否闰年

If语句的语法形式if (表达式)语句例:if (x > y) cout << x;if (表达式)语句1 else语句2例:if (x > y) cout << x;else cout << y;if (表达式1)语句1else if (表达式2)语句2else if (表达式3)语句3…else语句n#include <iostream>using namespac...

2020-10-29 21:34:17 1467

原创 5-1.C++中while和do...while的区别

先做后爱容易出伤害=。=while#include <iostream>using namespace std;int main(){ int sum,i=0; cout<<"int put i:"<<endl; cin>>i; while(i<=10){ sum+=i; i++; } cout<<"sum="<<sum; return 0;} do...while#include

2020-10-29 16:57:56 509

原创 4.C++条件表达式的简单使用

#include <iostream> using namespace std;int main(){ int a,b,x; cout<<"input the value of a:\n"; cin>>a; cout<<"input the value of b:\n"; cin>>b; x=a-b>0?a-b:b-a; cout<<"The difference of a and b is:\t\t"&.

2020-10-29 12:07:54 364

原创 3.C++变量初始化

#include <iostream> using namespace std;int main(){ const double pi(3.1459); int radis(0); cout<<"The initial radis is:"<<radis<<'\n'; cout<<"The pi is:"<<pi<<'\n'; cin>>radis; cout<<"The radis.

2020-10-28 16:52:24 129

原创 2.C++读入并显示整数

常量变量#include <iostream>using namespace std;int main() { const double pi(3.14159); //定义符号常量pi int radis;//定义变量 cout<<"Please enter the radis!\n"; cin>>radis;//从标准输入设备中读入一个整数存入radis中 cout<<"The radis is:"<<radis<&l.

2020-10-28 16:37:32 441

原创 定义控制台应用程序的入口点 ConsoleApplication

# include <stdio.h># include <iostream> ///iostream这个输入输出流类已经被包含起来 using namespace std;//用的标准的名词空间 int main(){ cout << "hello\n"; return 0;}

2020-10-27 16:36:03 1139

ssh_pracice1

用户管理系统demo,自己使用的,初学者自用里面有国际化校验等内容!!!!

2018-04-20

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除