随笔分类 - C++
摘要:1:条件运算符是一个三目运算符,能像判断语句一样完成判断。例如: max=(iA>iB) ? iA:iB; 意思是先判断iA是否大于iB,如果是,则max取iA的值,如果不是则取iB的值。 如果没有前边的max,那么就是先判断iA是否大于iB,如果是,就运行iA,如果不是则运行iB。 2:代码如下:
阅读全文
posted @ 2017-09-11 20:19
一串字符串
摘要:1:代码如下: // 3.6.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int iYear; cout << "请输入年份" << endl;
阅读全文
posted @ 2017-09-11 20:02
一串字符串
摘要:1:代码如下: // 3.5.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int iYear; cout << "请输入年份" << endl;
阅读全文
posted @ 2017-09-11 19:54
一串字符串
摘要:1:代码如下: // 3.4.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { cout<<"输入成绩"<<endl; int iInput; cin
阅读全文
posted @ 2017-09-11 19:40
一串字符串
摘要:1:代码如下: // 3.3.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int iInput; cout << "输入一个整数:" << end
阅读全文
posted @ 2017-09-11 19:36
一串字符串
摘要:1:代码如下: // 3.2.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int iInput; cout<<"大于90为优秀成绩"<<endl;
阅读全文
posted @ 2017-09-11 19:32
一串字符串
摘要:1:代码如下: // 3.1.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int iInput; cout << "输入一个整数" << endl
阅读全文
posted @ 2017-09-11 19:29
一串字符串
摘要:1:代码如下: // 2.17.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> using namespace std; void main() { float i, j; int k; i = 60.25; j = 20
阅读全文
posted @ 2017-09-11 19:09
一串字符串
摘要:1:代码如下: // 2.16.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> using namespace std; void main() { double result; char a='k'; int b=10;
阅读全文
posted @ 2017-09-11 19:05
一串字符串
摘要:1:代码如下: // 2.15.cpp : 定义控制台应用程序的入口点。 #include "stdafx.h" #include<iostream> using namespace std; void main() { int a=4,b=6,c=8,res1,res2; res1=a,res2=
阅读全文
posted @ 2017-09-11 18:59
一串字符串
摘要:1:代码如下: // 2.14.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { long nWord=0x12345678;//长整形,十六进制输入
阅读全文
posted @ 2017-09-11 18:35
一串字符串
摘要:1:代码如下: // 2.13.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> using namespace std; void main() { int a=0x40,b; b=a<<1;//左移1位 cout <<
阅读全文
posted @ 2017-09-11 16:53
一串字符串
摘要:1:代码如下: // 2.12.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include<iostream> using namespace std; void main() { int i=5,j=8,k=12,l=4,x1,x2; x1=i>j&&
阅读全文
posted @ 2017-09-11 16:43
一串字符串
摘要:1:代码如下: // 2.11.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { float x=20,y=-400.00; cout << x <<'
阅读全文
posted @ 2017-09-11 16:27
一串字符串
摘要:1:代码如下: // 2.10.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int x=123; double y=-3.1415; cout <
阅读全文
posted @ 2017-09-11 15:59
一串字符串
摘要:1:代码如下: #include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; void main() { int i = 0x2F, j = 255;//0x代表16进制, cout << i << e
阅读全文
posted @ 2017-09-11 15:42
一串字符串
摘要:1:代码如下: // 2.8.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; void main() { int b=123456; //对
阅读全文
posted @ 2017-09-11 15:31
一串字符串
摘要:1:代码如下: // 2.7.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> #include <iomanip> using namespace std; void main() { double a=123.4567
阅读全文
posted @ 2017-09-11 10:03
一串字符串
摘要:1:代码如下: // 2.6.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> using namespace std; void main() { int i=0; cout << i<< endl; cout << "
阅读全文
posted @ 2017-09-11 09:51
一串字符串
摘要:1:代码如下: // 2.5.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" int main() { long iLong; /*长整型变量*/ short iShort; /*短整型变量*/ int iNumber1=1; /*整型变量,为其赋值为1*/
阅读全文
posted @ 2017-09-11 09:45
一串字符串

浙公网安备 33010602011771号