เว็บไซต์เราจะอยู่ไม่ได้หากขาดเขาเหล่านี้ รวมช่วยกันสนับสนุนสปอนเซอร์ของพวกเรา
-
18th September 2013 21:17
#1
ช่วยด้วยครับ ภาษาซีผม eeror
คือผมต้องการที่จะคำนวณอัตราส่วน ปูิน ทราย หิน สมมติ ใส่1 ค่าจะออกมา เป็น 1:2:3 แต่ปัญหาเกิด มันไม่ออกตามนั้น ครับ ช่วยหน่อยนะครับ
#include<stdio.h>
#include<conio.h>
main()
{
int cement,sand,stone;
printf("Enter Cement : ");
scanf("%d",&cement);
cement == cement*1;
sand == cement*2;
stone == (cement*2)+1;
printf("%d : %d : %d",cement,sand,stone);
getch();
}
-
-
19th September 2013 17:56
#2
กระทู้ต้นฉบับโดยคุณ
casanovasby
คือผมต้องการที่จะคำนวณอัตราส่วน ปูิน ทราย หิน สมมติ ใส่1 ค่าจะออกมา เป็น 1:2:3 แต่ปัญหาเกิด มันไม่ออกตามนั้น ครับ ช่วยหน่อยนะครับ
#include<stdio.h>
#include<conio.h>
main()
{
int cement,sand,stone;
printf("Enter Cement : ");
scanf("%d",&cement);
cement == cement*1;
sand == cement*2;
stone == (cement*2)+1;
printf("%d : %d : %d",cement,sand,stone);
getch();
}
ลืม
void main()
หรือปล่าว - -
ผมอย่างไม่ได้ลองรันนะไม่ว่างโทษที
-
-
19th September 2013 18:18
#3
Edit : เข้าใจละ คือโปรแกรม รันได้ แต่ เลขผิด
#include<stdio.h>
#include<conio.h>
main()
{
int cement,sand,stone;
printf("Enter Cement : ");
scanf("%d",&cement);
cement = cement*1;
sand = cement*2;
stone = (cement*2)+1;
printf("%d : %d : %d",cement,sand,stone);
getch();
}
แบบนี้รึป่าวครับ
แก้ไขครั้งสุดท้ายโดย arada_vivi : 19th September 2013 เมื่อ 18:26
-
-
19th September 2013 19:05
#4
cement = cement * 1; <<< รับค่า Cement มาแล้วมิใช่รึ ?
-
-
20th September 2013 13:52
#5
เขียน ฟังก์ชั่น เพิ่มอีกดีกว่า จะได้ดูง่ายขึ้น
จะได้แก้ไขง่ายตาม
-
-
20th September 2013 14:16
#6
ใส่ = อันเดียวไม่ใช่หรอ
ปล.error เขียนแบบนี้น่ะครับ
-
-
20th September 2013 15:17
#7
กระทู้ต้นฉบับโดยคุณ
casanovasby
คือผมต้องการที่จะคำนวณอัตราส่วน ปูิน ทราย หิน สมมติ ใส่1 ค่าจะออกมา เป็น 1:2:3 แต่ปัญหาเกิด มันไม่ออกตามนั้น ครับ ช่วยหน่อยนะครับ
#include<stdio.h>
#include<conio.h>
main()
{
int cement,sand,stone;
printf("Enter Cement : ");
scanf("%d",&cement);
cement == cement*1;
sand == cement*2;
stone == (cement*2)+1;
printf("%d : %d : %d",cement,sand,stone);
getch();
}
Operator ผิดแก้ใหม่
#include<stdio.h>
#include<conio.h>
main()
{
int cement,sand,stone;
printf("Enter Cement : ");
scanf("%d",&cement);
cement = cement*1;
sand = cement*2;
stone = (cement*2)+1;
printf("%d : %d : %d",cement,sand,stone);
getch();
}
ปล. = กับ == คนละอย่างกันนะ
Nothing is "Impossible" as impossible itself says "I-m-possible".
>>
งดให้ความช่วยเหลือกับผู้ใช้ภาษาไทยไม่ถูกต้อง<<
--> ก่อนจะตั้งคำถามควรลองใช้
Google ค้นหาก่อน <--
-
กฎการส่งข้อความ
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules