CHAWTeam
目錄:DICE C語言程式破解
寫一個程式,印出「HaHaHa!」,
不管我說什麼都持續印「HaHaHa!」,
直到我說「-1」,才停止。
輸入範例:
2
3
4
5
-1
輸出範例:
HaHaHa!
HaHaHa!
HaHaHa!
HaHaHa!
C範例程式:
#include <stdio.h>
int main(){
int x=0;
scanf("%d",&x);
while(........){
printf("HaHaHa!\n");
scanf("%d",&x);
}
return 0;
}
C++範例程式
#include <iostream>
int main()
{
int x=0;
std::cin>>x;
while(x!=-1){
std::cout<<"HaHaHa!\n";
std::cin>>x;
}
return 0;
}
#include <stdio.h>
int main()
{
int x = 0;
scanf("%d", &x);
while(x != -1)
{
printf("HaHaHa!\n");
scanf("%d", &x);
}
return 0;
}
2
HaHaHa!
3
HaHaHa!
4
HaHaHa!
5
HaHaHa!
-1
查看我們在HackMD上的所有筆記
目錄:DICE C語言程式破解