C++学习
XuLu2013
这个作者很懒,什么都没留下…
展开
-
Week7-2三个正整数的最大值
/*2014年10月16日*****//*Week7-2求出两数的正差值并输出******/#includeusing namespace std;int main(){ int a, b, Res; cout << "输入两正值:"; cin >> a>>b; if(a>b)Res=a-b; else Res = b - a; cout << "两数的正差值:" << Re原创 2014-10-16 17:10:05 · 446 阅读 · 0 评论 -
Week7-1圆柱体表面积
/*2014年10月16日*****//*Week7-1圆柱体表面积******/#include#define Pi 3.1415926 using namespace std;int main(){ double r, h, Area; cout << "输入半径:"; cin >> r; cout << "输入高:"; cin >> h; Area = 2 * Pi*原创 2014-10-16 16:34:11 · 431 阅读 · 0 评论 -
Week7-3输出星号图
/*2014年10月16日*****//*Week7-3输出星号图******/#includeusing namespace std;int main(){ int i,j; //倒直角 for (i = 5; i >=0; i--){ for (j = 0; j < 2 * i + 1; j++) cout << "*"; cout << "\n"; } //原创 2014-10-16 19:12:14 · 492 阅读 · 0 评论 -
Week7-1两个电阻并联后的阻值
/*2014年10月16日*****//*Week7-1两个电阻并联后的阻值******/#includeusing namespace std;int main(){ double R1, R2, R; cout << "输入两电阻值:"; cin >> R1>>R2; R = R1*R2/(R1+R2); cout << "两个电阻并联后的阻值:" << R << "\n"原创 2014-10-16 16:52:07 · 390 阅读 · 0 评论 -
Week8-用if语句实现分支结构程序设计
/*2014年10月16日*****//*Week8-用if语句实现分支结构程序设计******/#include#include"math.h"using namespace std;int main(){ float x, y; cout << "输入x的值:"; cin >> x; if (x < 2)y = x; else if (x < 6)y = x*x + 1;原创 2014-10-16 20:12:33 · 519 阅读 · 0 评论 -
Week10-乘法表
/*2014年10月16日*****//*Week10-乘法表******/#include#include using namespace std;int main(){ int i,j; for (i = 1; i <= 9; i++){ for (j = 1; j <= i; j++){ cout << j << "x" << i << "="; cout <原创 2014-10-16 21:10:18 · 372 阅读 · 0 评论 -
c/c++中串的处理及串的相关操作实现
c语言中字符串以字符数组的形式存储。在头文件string.h中定义了一系列字符串的操作。如strlen(),strcpy(),strcmp()等。C++中有string类,可直接用string定义对象,类中定义了相关的串操作。void strcpy(char* pstr1,char* pstr2){ while(*pstr1++=*pstr2++);}int strlen(c原创 2015-05-24 20:44:23 · 608 阅读 · 0 评论