文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>最近学习的简单源码 三

最近学习的简单源码 三

时间:2010-10-13  来源:天佑乐天

  1. #include "iostream.h" 
  2. #include "math.h" 
  3. #include "stdlib.h" 
  4. int main() 
  5.     const double pi=3.1415926; 
  6.     double a=90; 
  7.     cout<<"sin(a)="<<sin(a/360*2*pi)<<endl; 
  8.     cout<<"cos(a)="<<cos(a/360*2*pi)<<endl; 
  9.     cout<<"tan(a)="<<tan(a/360*2*pi)<<endl; 
  10.     cout<<"sqrt(a)="<<sqrt(a)<<endl; 
  11.     cout<<"pow(a,2)="<<pow(a,2)<<endl; 
  12.     exit(1); 
  13.     return 0; 
  1. #include <iostream> 
  2. using std::cout; 
  3. using std::cin; 
  4. //using std::sizeof; 
  5. using std::endl; 
  6. int main() 
  7.     char a[]={"hello"}; 
  8.     char b[]={'h','e','l','l','o'}; 
  9.     char c[]={'h','e','l','l','o','\0'}; 
  10.     cout<<"size of a="<<sizeof(a)<<endl; 
  11.     cout<<"size of b="<<sizeof(b)<<endl; 
  12.     cout<<"size of c="<<sizeof(c)<<endl; 
  13.     cout<<a<<endl; 
  14.     cout<<b<<endl; 
  15.     cout<<c<<endl; 
  16.     return 0; 
  1. #include <iostream> 
  2. using namespace std; 
  3. void output(int a); 
  4. int main() 
  5. {  
  6.     int temp; 
  7.     int array[5]; 
  8.     for (int i=0;i<=4;i++) 
  9.     { 
  10.         cin>>temp; 
  11.         array[i]=temp; 
  12.     } 
  13.     for (int j=0;j<=4;j++) 
  14.     { 
  15.         output(array[j]); 
  16.         cout<<endl; 
  17.     } 
  18.     return 0; 
  19.  
  20. void output(int a)//输出星号 
  21.     for (int i=1;i<=a;i++) 
  22.     { 
  23.         cout<<"*"
  24.     } 
  25.     return

 

排行榜 更多 +
坦克冒险大师安卓版

坦克冒险大师安卓版

策略塔防 下载
自动防御

自动防御

策略塔防 下载
枪战大乱斗2

枪战大乱斗2

飞行射击 下载