C Constructs for Iteration - while Loops while (condition) { statement การแปล - C Constructs for Iteration - while Loops while (condition) { statement ไทย วิธีการพูด

C Constructs for Iteration - while

C Constructs for Iteration - while Loops
while (condition)
{
statement1;
statement2;
statement3;
...
}
condition is a logical expression which will evaluate to either true or false.
The statements in the loop body (the statements inside the curly braces) are repeated as long as the condition remains true.
The loop body may contain a statement that will potentially change the value of the condition from true to false. (If there is no such statement the loop will continue forever. You may or may not want that.)
If condition is false the first time the code reaches the while test, the statements in the loop body will not be executed even once.
Example
char inputData[32];
int value = 0;
long total = 0;
/* Loop, getting values from the user and adding them
* to the total, until the user enters a negative value.
* Then stop.
*/
while (value >= 0 )
{
printf("Enter a value, -1 to stop: ");
fgets(inputData,32,stdin);
sscanf(inputData,"%d",&value);
if (value >= 0)
{
total = total + value;
}
}
0/5000
จาก: -
เป็น: -
ผลลัพธ์ (ไทย) 1: [สำเนา]
คัดลอก!
C สร้างสำหรับการเกิดซ้ำ - ในขณะที่วนรอบ
ขณะ (เงื่อนไข)
{
statement1;
statement2;
statement3;
...
}
เงื่อนไขเป็นนิพจน์ตรรกะซึ่งจะประเมินเป็นจริงหรือเท็จ
ถูกทำซ้ำคำสั่งในตัววง (งบภายในปีก) ตราบใดที่เงื่อนไขยังคงเป็นจริง
วนร่างกายอาจประกอบด้วยคำสั่งที่อาจจะเปลี่ยนค่าของเงื่อนไขจากจริงเป็นเท็จ (หากมีคำสั่งดังกล่าวไม่ ลูปจะทำตลอดไป คุณอาจ หรืออาจไม่ต้องการที่)
ถ้าเงื่อนไขเป็นเท็จเป็นครั้งแรกในขณะมาถึงรหัสทดสอบ คำสั่งในลูปร่างกายจะไม่ได้ปฏิบัติแม้ครั้ง
อย่าง
inputData อักขระ [32];
ค่า int = 0;
ยาวรวม = 0;
/ * วน การรับค่าจากผู้ใช้ และเพิ่ม
* รวม จนกว่าผู้ใช้ป้อนการลบค่าการ
* แล้วหยุด
* /
ขณะ (ค่า > = 0)
{
printf ("ป้อนค่า -1 หยุด: ");
fgets(inputData,32,stdin);
sscanf(inputData,"%d",&value);
ถ้า (ค่า > = 0)
{
รวม =ผลรวมมูลค่า;
}
}
การแปล กรุณารอสักครู่..
ผลลัพธ์ (ไทย) 2:[สำเนา]
คัดลอก!
C Constructs for Iteration - while Loops
while (condition)
{
statement1;
statement2;
statement3;
...
}
condition is a logical expression which will evaluate to either true or false.
The statements in the loop body (the statements inside the curly braces) are repeated as long as the condition remains true.
The loop body may contain a statement that will potentially change the value of the condition from true to false. (If there is no such statement the loop will continue forever. You may or may not want that.)
If condition is false the first time the code reaches the while test, the statements in the loop body will not be executed even once.
Example
char inputData[32];
int value = 0;
long total = 0;
/* Loop, getting values from the user and adding them
* to the total, until the user enters a negative value.
* Then stop.
*/
while (value >= 0 )
{
printf("Enter a value, -1 to stop: ");
fgets(inputData,32,stdin);
sscanf(inputData,"%d",&value);
if (value >= 0)
{
total = total + value;
}
}
การแปล กรุณารอสักครู่..
ผลลัพธ์ (ไทย) 3:[สำเนา]
คัดลอก!
สำหรับการสร้าง C ในขณะที่ลูป
ในขณะที่ ( เงื่อนไข ) {

statement1 statement2 statement3 ;
;
;
.
}
สภาพเป็นตรรกะการแสดงออกซึ่งจะประเมินทั้งจริงหรือเท็จ .
งบในร่างกายห่วง ( งบภายในวงเล็บปีกกาหยิก ) ซ้ำตราบเท่าที่เงื่อนไข
ยังคงเป็นจริงตัวห่วงอาจประกอบด้วยข้อความที่อาจจะเปลี่ยนค่าของเงื่อนไข จากจริงเป็นเท็จ ( ถ้าไม่มีงบ ห่วงจะยังคงอยู่ตลอดไป คุณอาจจะหรืออาจจะไม่อยากได้ )
ถ้าเงื่อนไขเป็นเท็จครั้งแรกรหัสถึงขณะทดสอบ งบในตัวห่วงจะไม่ถูกประหารชีวิต แม้แต่ครั้งเดียว เช่น ถ่าน inputdata

[ 32 ] ;
1 ค่า = 0 ;
ยาวรวม = 0 ;
/ * loop รับค่าจากผู้ใช้ และเพิ่มพวกเขา
* ทั้งหมด จนกว่าผู้ใช้จะเข้าสู่ค่าลบ .
*

* / แล้วหยุด ในขณะที่ ( ค่า > = 0 )
{
printf ( " ระบุเป็นค่า - 1 หยุด " ) ;
fgets ( inputdata , 32 , STDIN ) ;
sscanf ( inputdata " % d " &ค่า ) ;
( ถ้าค่า > = 0 )
{

} = มูลค่ารวม
} ;
การแปล กรุณารอสักครู่..
 
ภาษาอื่น ๆ
การสนับสนุนเครื่องมือแปลภาษา: กรีก, กันนาดา, กาลิเชียน, คลิงออน, คอร์สิกา, คาซัค, คาตาลัน, คินยารวันดา, คีร์กิซ, คุชราต, จอร์เจีย, จีน, จีนดั้งเดิม, ชวา, ชิเชวา, ซามัว, ซีบัวโน, ซุนดา, ซูลู, ญี่ปุ่น, ดัตช์, ตรวจหาภาษา, ตุรกี, ทมิฬ, ทาจิก, ทาทาร์, นอร์เวย์, บอสเนีย, บัลแกเรีย, บาสก์, ปัญจาป, ฝรั่งเศส, พาชตู, ฟริเชียน, ฟินแลนด์, ฟิลิปปินส์, ภาษาอินโดนีเซี, มองโกเลีย, มัลทีส, มาซีโดเนีย, มาราฐี, มาลากาซี, มาลายาลัม, มาเลย์, ม้ง, ยิดดิช, ยูเครน, รัสเซีย, ละติน, ลักเซมเบิร์ก, ลัตเวีย, ลาว, ลิทัวเนีย, สวาฮิลี, สวีเดน, สิงหล, สินธี, สเปน, สโลวัก, สโลวีเนีย, อังกฤษ, อัมฮาริก, อาร์เซอร์ไบจัน, อาร์เมเนีย, อาหรับ, อิกโบ, อิตาลี, อุยกูร์, อุสเบกิสถาน, อูรดู, ฮังการี, ฮัวซา, ฮาวาย, ฮินดี, ฮีบรู, เกลิกสกอต, เกาหลี, เขมร, เคิร์ด, เช็ก, เซอร์เบียน, เซโซโท, เดนมาร์ก, เตลูกู, เติร์กเมน, เนปาล, เบงกอล, เบลารุส, เปอร์เซีย, เมารี, เมียนมา (พม่า), เยอรมัน, เวลส์, เวียดนาม, เอสเปอแรนโต, เอสโทเนีย, เฮติครีโอล, แอฟริกา, แอลเบเนีย, โคซา, โครเอเชีย, โชนา, โซมาลี, โปรตุเกส, โปแลนด์, โยรูบา, โรมาเนีย, โอเดีย (โอริยา), ไทย, ไอซ์แลนด์, ไอร์แลนด์, การแปลภาษา.

Copyright ©2025 I Love Translation. All reserved.

E-mail: