「1」の最初の機能の直後にプログラムを終了するのではなく、別の機能に進む方法を選択するにはどうすればよいですか?他の機能を選択するためにメニューを再作成するようなものがあります。例:2または3現在の機能を完了したら、別の機能に進むように選択するにはどうすればよいですか?
#include <stdio.h>
int testing(); int rewarding(); int buying();
void main()
{
int menu;
printf("Enter 1 for testing:\n");
printf("Enter 2 for rewarding:\n");
printf("Enter 3 for buying:\n");
scanf("%d", &menu);
if (menu == 1) { //first function
testing();
}
else if (menu == 2) { //second function
rewarding();
}
else if (menu == 3) { //third function
buying();
}
system("pause");
}
testing() {
printf("this is the first function\n"); // proceed to selection menu to choose another function when first function is completed
return(0);
}
rewarding() {
printf("this is the second function\n");
return (0);
}
buying() {
printf("this is the third function\n");
return(0);
}
「メイン」のループ。 – LogicStuff
@LogicStuff申し訳ありません、私は初心者です。より具体的になりますか?または作品を見せる? ありがとう –
CまたはC++でループを使用する方法をお読みください。そこには無数の例があります。それは手続き型言語の基本的なツールの1つです。 – paddy