Two sets of data from the same structure C ++ exchange

Made a sort of song title, the beginning of a type of a simple-minded type of exchange by the number of clicks, then you can try only to find the whole exchange (= _ =) ...

#include <iostream>

using namespace std;

struct  all{ 
 	char music[30]  ;  char  name[20]  ;  int  number ;
 	};
 	
int main () 
{
	struct all list[5],temp ;//这里让list[1]和list[2]整体交换。
	temp = list[1];           //类似于整数的两两交换。
	list[1] = list[2];
	list[2] = temp;
	
	return 0;
} 

Released four original articles · won praise 5 · Views 121

Guess you like

Origin blog.csdn.net/cmomo99d/article/details/104745086
Recommended