Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of Modular programming of Python function

Shulou Source: shulou.com Published: 2022-06-01 01:05:07 10月16日 Update

This article mainly introduces the relevant knowledge of "the method of modular programming of Python function". The editor shows you the operation process through the actual case, and the operation method is simple, fast and practical. I hope this article "the method of modular programming of Python function" can help you solve the problem.

# include

Int main ()

{

Int iChioce

Do

{

Printf ("* 1. Eat\ n")

Printf ("* 2. Sleep\ n")

Printf ("* 3. Beat Doudou\ n")

Printf ("* 0. Exit\ n")

Printf ("* Please select (0-3):")

Scanf ("d", & iChioce)

/ / processing after selection

If (iChioce==1)

Printf ("I eat.\ n")

Else if (iChioce==2)

Printf ("I sleep.\ n")

Else if (iChioce==3)

Printf ("I'll fight.\ n")

Else if (iChioce==0)

Break

Else

{

Printf ("\ 007 selection error!\ n")

Continue

}

Printf ("Congratulations on completing a job!\ n")

}

While (1)

Return 0

}

# include

Int choose ()

Void eat ()

Void sleep ()

Void hitdoudou ()

Int main ()

{

Int iChioce

Do

{

IChioce=choose ()

If (iChioce==1)

Eat ()

Else if (iChioce==2)

Sleep ()

Else if (iChioce==3)

Hitdoudou ()

Else if (iChioce==0)

Break

Else

{

Printf ("\ 007 selection error!\ n")

Continue

}

Printf ("Congratulations on completing a job!\ n")

}

While (1)

Return 0

}

Int choose ()

{

Int i

Printf ("\ n * 1. Eat\ n")

Printf ("* 2. Sleep\ n")

Printf ("* 3. Beat Doudou\ n")

Printf ("* 0. Exit\ n")

Printf ("* Please select (0-3):")

Scanf ("d", & I)

Return i

}

Void eat ()

{

Printf ("I eat.\ n")

}

Void sleep ()

{

Printf ("I sleep.\ n")

}

Void hitdoudou ()

{

Printf ("I'll fight.\ n")

}

This is the end of the introduction of "the method of modular programming of Python function". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Choices methods functions modules programs programming design knowledge industry errors beans work different practical content practical practical articles more cases Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei NVidia vpn Xiaomi Apple