摘要:
#include <iostream> using namespace std; int main(int argc, char *argv[]) { string str; cout<<"请随便输入一个字符串"; cin>>str; //空格影响了cin的接受 // getline(cin,str); cout ... 阅读全文
posted @ 2013-02-27 19:08
搅着青春吹泡泡
阅读(837)
评论(0)
推荐(0)
摘要:
c++中的代码实现 自己实现的#include <iostream>using namespace std; int sum(int *p,int len); double avg(int i,int len);int main(int argc, char *argv[]){ int array[10]; int i; cout<<"请输入你的数组元素"<<endl; for(i=0;... 阅读全文
posted @ 2013-02-27 19:01
搅着青春吹泡泡
阅读(340)
评论(0)
推荐(0)
摘要:
C++里的函数重载 overloading 机制比我们此前见到的东西都更加高深,这种语言的灵活性和强大功能在它身上体现的淋漓尽致所谓函数重载的实质 是用同样的名字在定义 一个有着不同参数但有着同样用途的函数(人格分类…多重身份)函数重载 到底是什么样的#include <iostream>#include <math.h>float calc(float i);float calc(float i,float k);float calc(float i,float j,float k);using namespace std;int main(int argc, cha 阅读全文
posted @ 2013-02-27 18:18
搅着青春吹泡泡
阅读(121)
评论(0)
推荐(0)
摘要:
华氏摄氏的转换-- 华氏的转换有错误在哪里#if(0)//温度单位转换器 #include <stdio.h>int main(int argc, char *argv[]){ float i; printf("请输入您现在的摄氏温度 :"); scanf("%f",&i); float y; y= i*9/5 +32; printf("您所对应的华氏温度是:%.2f",y); return 0;}#endif#if(1)#include <iostream>using namespace std;in 阅读全文
posted @ 2013-02-27 17:35
搅着青春吹泡泡
阅读(411)
评论(0)
推荐(0)
摘要:
用c++ 完成的 的样式, 这里#include <iostream>//using namespace std;int main(int argc, char *argv[]){ char answer; std::cout <<"请问可以格式化您的硬盘吗 ?【Y/N】"<<"\n"; std::cin>>answer ; switch(answer) { case 'Y': case 'y': std::cout<<"随便格式化是十分危险的,小心为妙 阅读全文
posted @ 2013-02-27 17:13
搅着青春吹泡泡
阅读(199)
评论(0)
推荐(0)
摘要:
#include <stdio.h>#include <ctype.h>int main(int argc, char *argv[]){ char i; printf("Do you like the film yes or no?y/n?"); scanf("%c",&i); while(1) { i =toupper(i); if(i=='Y') { printf(" i love u too\n"); break; } else if(i=='N'){ print 阅读全文
posted @ 2013-02-27 16:30
搅着青春吹泡泡
阅读(447)
评论(0)
推荐(0)
摘要:
#include <iostream>#include <math.h>using namespace std;int main(int argc, char *argv[]){ double result1 =sqrt(3.0); cout<<"对3开方保留小数后0-9位 ,结果如下:\n"<<endl; for(int i=0;i<=9;i++) { cout.precision(i); cout<< result1 <<endl; } cout<<"当前的输出精度为:& 阅读全文
posted @ 2013-02-27 01:00
搅着青春吹泡泡
阅读(708)
评论(0)
推荐(0)
摘要:
#include <stdio.h>#include <stdlib.h>int main(void){ int i; int sum=0; char ch; printf("输入数字和任意空格:"); while(scanf("%d",&i)==1) { sum = sum+i; while((ch=getchar())==' ')// 想把自己搞死的话 ,这里 ch=getchar() ==' '试试 ; if(ch=='\n')... 阅读全文
posted @ 2013-02-27 00:16
搅着青春吹泡泡
阅读(258)
评论(0)
推荐(0)

浙公网安备 33010602011771号