zoukankan      html  css  js  c++  java
  • 代码1

     1 #include <iostream>//字符串排序
     2 #include <string>
     3 using namespace std;
     4 void main()
     5 {
     6     void sort(string &,string &,string &);
     7     string a,b,c;
     8     string a1,b1,c1;
     9     cin>>a>>b>>c;
    10     a1=a;b1=b;c1=c;
    11     sort(a1,b1,c1);
    12     cout<<a1<<" "<<b1<<" "<<c1<<" "<<endl;
    13     system("pause");
    14 }
    15 void sort(string &i,string &j,string &k)
    16 {
    17     void change(string &,string &);
    18     if(i.length()>j.length()) change(i,j);
    19     if(i.length()>k.length()) change(i,k);
    20     if(j.length()>k.length()) change(j,k);
    21 }
    22 void change(string &x,string &y)
    23 {
    24     string temp;
    25     temp=x;x=y;y=temp;
    26 }
     1 #include <iostream>
     2 using namespace std;
     3 void main()
     4 {
     5     int a[10],m;
     6     cout<<"输入10个数:"<<endl;
     7     for(int i=0;i<10;i++)
     8         cin>>a[i];
     9     cout<<"输入移动的个数(少于10):"<<endl;
    10     cin>>m;
    11     int *p=a;
    12     for(;*p<m+1;p++)
    13         cout<<*(p+(10-m))<<" ";
    14     for(int j=0;j<10-m;j++)
    15         cout<<a[j]<<" ";
    16     system("pause");
    1 #include <iostream>
    2 #include <string>
    3 using namespace std;
    4 void main()
    5 {
    6     string str;
    7     cin>>str;
    8     cout<<str.length()<<endl;
    9 }
    
    
     1 #include <iostream>
     2 using namespace std;
     3 void main()
     4 {
     5     void change(int &,int &);
     6     cout<<"输入3*3的矩阵:"<<endl;
     7     int a[3][3],*p=&a[0][0];
     8     for(int i=0;i<9;i++)
     9         cin>>*(p+i);
    10     for(int k=0;k<2;k++)
    11         for(int l=0;l<3;l++)
    12         change(a[k][l],a[l][k]);
    13     change(a[0][1],a[1][0]);//是矩阵能得到所要求的式子
    14     cout<<"倒置后得到:"<<endl;
    15     for(int m=0;m<3;m++)
    16         for(int n=0;n<3;n++)
    17         {
    18             cout<<a[m][n]<<" ";
    19             if(n==2)
    20                 cout<<endl;
    21         }
    22         system("pause");
    23 }
    24 //-----------------------------------------------
    25 void change(int &x,int &y)
    26 {
    27     int temp;
    28     temp=x;x=y;y=temp;
    29 }
    17 }
  • 相关阅读:
    115今天太给力了~
    使用jQuery顺序显示元素
    温习浏览器渲染模式
    去除浏览器a标签链接时,烦人的虚线框
    设计可以是一种垄断
    如何获取鼠标选中的文字
    积极参与到FuckIE6的队伍中...
    google今儿发现页面又变好看了
    20101207google 今天出新功能了
    火狐ff下margintop太给力
  • 原文地址:https://www.cnblogs.com/herizai/p/3101940.html
Copyright © 2011-2022 走看看