ช่วยแก้ไขทีครับ
The user enters the height, width, length of a box. The program calculates the volume.
Requirements:
You will store the numbers in an array.
You will use scanf with 1 input (float).
You will use floats for all values.
You will use a for loop to get the inputs.
You will NOT allow bad inputs (string/char).
Remember scanf needs an ADDRESS
อันนี้เป็นโคดที่ผมลองเขียน แต่มันยังไม่ได้ตามที่โจทย์บอกอะครับ เลยไม่รู้ทำยังไงแล้ว คัยทำได้ช่วยแกไขให้ทีครับ
#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <conio.h>
main()
{
int i;
float h,w,l,v;
a: {
printf ("\nPlease enter the number of height : ");
scanf ("%f",&h);
printf ("\nPlease enter the number of width : ");
scanf ("%f",&w);
printf ("\nPlease enter the number of length : ");
scanf ("%f",&l);
v = h*w*l ;
printf ("\nThe value is:", v );
printf ("\n\n\nPlease enter the number (1)to continue (2) to go out");
scanf("%d",&v);
for (i=1;i>1;i++) {
if (i=1) { goto a; };
if (i=2) { return 0; }
else {printf ("please enter the number (1)to continue (2) to go out"); }
};
}
}
มันไม่วนลูป แล้วก็ ถ้าไส่ตัวอักษร ไปโปรแกรมก็ยังทำงานต่อ ผมทำไม่เป็นแล้วครับ ช่วยที
ช่วยแก้ไขทีครับ The user enters the height, width, length of a box. The program
Moderators: mindphp, ผู้ดูแลกระดาน
-
- PHP Newbie
- Posts: 1
- Joined: 10/07/2011 5:50 pm
-
- Similar Topics
- Replies
- Views
- Last post
-
-
CSS border-bottom-width การกำหนดความหนาเฉพาะด้านให้กับเส้นกรอบ
by GoB » 19/03/2015 5:34 pm » in CSS Knowledge - 0 Replies
- 1168 Views
-
Last post by GoB
19/03/2015 5:34 pm
-
-
-
ทำความรู้จักกับภาษา python (18) : การสร้างฟังก์ชันโดยมี Variable-length (วาริเอเบิล-เล็งธ)
by dawthana » 09/01/2017 4:48 pm » in Python Knowledge - 10 Replies
- 1375 Views
-
Last post by jirawoot
20/06/2019 3:49 pm
-
-
-
ลง template joomla ไม่ได้อ่ะครับ Warning: POST Content-Length of 11551554 bytes
by TONGDE » 07/01/2013 7:28 pm » in ปัญหาการใช้ phpBB3, SMF, Joomla, Wordpress, CMS, CRM - 8 Replies
- 3791 Views
-
Last post by clark5901
30/01/2013 4:46 pm
-
-
-
[Extension phpBB3.1.1] Set forum width Extension เป็นการตั้งค่าความกว้างฟอรัม
by จันนุสรณ์ ดีแก่ » 22/01/2019 11:33 am » in phpBB 3.1 Extension Review - 0 Replies
- 443 Views
-
Last post by จันนุสรณ์ ดีแก่
22/01/2019 11:33 am
-
-
- 1 Replies
- 359 Views
-
Last post by prmindphp
21/05/2020 5:57 pm
Who is online
Users browsing this forum: chakirin.bfds and 4 guests