您好,欢迎来到纷纭教育。
搜索
您的当前位置:首页结构体里的数比较大小

结构体里的数比较大小

来源:纷纭教育
/*结构体里的数比较大小,只可以用小于号,不可以用大于号只能在p<a.p(升序)改a.p<p(降序)*/
#include<iostream>
#include <conio.h>
#include<algorithm>
using namespace std;
struct node
{
    int p;
    bool operator < (const node &a)const
    {    
        return p<a.p;
    }

};
int main()
{
    node no[7]={1,2,9,4,8,6,7};
    sort(no,no+7);
    for(int i=0;i<7;i++)
        cprintf("%d\n",no[i]);
    char c;
    cin>>c;
    c=tolower(c);//大写转换成小写
    printf("%c\n",c);
    return 0;
}

 

转载于:https://www.cnblogs.com/heqinghui/archive/2012/10/03/2711027.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- fenyunshixun.cn 版权所有 湘ICP备2023022495号-9

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务