Water conservancy and hydropower engineering C language Mekong Hydropower Station applet

background:

A classmate was asked by the teacher to make a C language program related to water conservancy. At first, the idea was very high-level, which is basically equivalent to real-time. It is better to use python, but the classmate asked for C, which would be very troublesome. The blogger was curious The attitude was communicated.

After communication, I decided to try the C language in the form of dead code. The blogger said that he really didn't know that the Lancang River is the Mekong River! ! !

Realize the effect:

code:

//vx-zew1040994588
//水电站结构体 
struct hydropower_station {
	char name[128];
	float eletricity_per_day; 		
};

void viewInfo(struct hydropower_station* hs, int n) {
	int i = 0; 
	for(i = 0; i < n; i++) {
		printf("*****\n");
		printf("水电站名称:%s\n", hs[i].name);
		printf("水电站每日平均产电量%f千瓦时\n", hs[i].eletricity_per_day * 10000);
		printf("*****\n");
	}
}

int main() {
	struct hydropower_station hs[6];
	int i = 0;
	strcpy(hs[0].name,"冬中水电站");
	strcpy(hs[1].name,"果多水电站");
	strcpy(hs[2].name,"向达水电站");
	strcpy(hs[3].name,"如意水电站");
	strcpy(hs[4].name,"林场水电站");
	strcpy(hs[5].name,"侧格水电站");
	srand((unsigned)time(NULL));

Guess you like

Origin blog.csdn.net/Elephantpretty/article/details/131216350