最近学习的简单源码 三
时间:2010-10-13 来源:天佑乐天
- #include "iostream.h"
- #include "math.h"
- #include "stdlib.h"
- int main()
- {
- const double pi=3.1415926;
- double a=90;
- cout<<"sin(a)="<<sin(a/360*2*pi)<<endl;
- cout<<"cos(a)="<<cos(a/360*2*pi)<<endl;
- cout<<"tan(a)="<<tan(a/360*2*pi)<<endl;
- cout<<"sqrt(a)="<<sqrt(a)<<endl;
- cout<<"pow(a,2)="<<pow(a,2)<<endl;
- exit(1);
- return 0;
- }
- #include <iostream>
- using std::cout;
- using std::cin;
- //using std::sizeof;
- using std::endl;
- int main()
- {
- char a[]={"hello"};
- char b[]={'h','e','l','l','o'};
- char c[]={'h','e','l','l','o','\0'};
- cout<<"size of a="<<sizeof(a)<<endl;
- cout<<"size of b="<<sizeof(b)<<endl;
- cout<<"size of c="<<sizeof(c)<<endl;
- cout<<a<<endl;
- cout<<b<<endl;
- cout<<c<<endl;
- return 0;
- }
- #include <iostream>
- using namespace std;
- void output(int a);
- int main()
- {
- int temp;
- int array[5];
- for (int i=0;i<=4;i++)
- {
- cin>>temp;
- array[i]=temp;
- }
- for (int j=0;j<=4;j++)
- {
- output(array[j]);
- cout<<endl;
- }
- return 0;
- }
- void output(int a)//输出星号
- {
- for (int i=1;i<=a;i++)
- {
- cout<<"*";
- }
- return;
- }
相关阅读 更多 +