• 代码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 }
  • 相关阅读:
    一个简单的禁止鼠标滚轮事件处理
    模仿抽奖转盘,并且用cookie记录历史次数
    学习jquery
    使用var提升变量声明
    Django 自带密码加密,自定密码加密方式 及自定义验证方式
    kindEditor使用并防止xss攻击(day88)
    python二维码生成库(qrcode)简介和实例
    js原型的区别
    js中 this与that
    python单元测试之unittest框架使用总结
  • 原文地址:https://www.cnblogs.com/herizai/p/3101940.html
Copyright © 2020-2023  润新知