c語言交換 c語言結(jié)構(gòu)體數(shù)組怎么交換?
c語言結(jié)構(gòu)體數(shù)組怎么交換?定義一個(gè)structcjtemp并直接交換。我把那塊做成一個(gè)函數(shù),房東直接調(diào)用,主要函數(shù)不完整。#包括(&L)。H>structcj{intnocharame[20]in
c語言結(jié)構(gòu)體數(shù)組怎么交換?
定義一個(gè)structcjtemp并直接交換。我把那塊做成一個(gè)函數(shù),房東直接調(diào)用,主要函數(shù)不完整。#包括(&L)。H>structcj{intnocharame[20]intcj1intcj2intcj3intpingjunintnumber}intmain(intargc,char*argv)}{structcjstudent[50]void port(structcj*student,INTN)sort(student,50)return N0}void port(structcj*student,INTN)/*從大到小*/{intflaginti,jsstructcjtempfor(I=0I<n-1i){flag=0For(J=0j<n-I-1j))if(student[J].pingjun<student[J 1].pingjun){flag=1temp=student[J 1]student[J 1]=student[J]=temp}if(flag==0)break}