อันนี้เป็นงานที่เวลาinputค่าลงไป แล้วแสดงค่าในข้อความทีเดียวเลยค่ะ
#include <stdio.h>
#include <stdlib.h>
int main()
{
int y1,m1,w1,d1,h1,min1,sec1,y2,m2,w2,d2,h2,min2,sec2;
printf("Enter the year1 => ");
scanf("%d",y1);
printf("Enter the month1 => ");
scanf("%d",&m1);
printf("Enter the week1 => ");
scanf("%d",&w1);
printf("Enter the day1 => ");
scanf("%d",&d1);
printf("Enter the hour1 => ");
scanf("%d",&h1);
printf("Enter the min1 => ");
scanf("%d",&min1);
printf("Enter the sec1 => ");
scanf("%d",&sec1);
printf("Enter the year2 => ");
scanf("%d",&y2);
printf("Enter the month2 => ");
scanf("%d",&m2);
printf("Enter the week2 => ");
scanf("%d",&w2);
printf("Enter the day2 => ");
scanf("%d",&d2);
printf("Enter the hour2 => ");
scanf("%d",&h2);
printf("Enter the min2 => ");
scanf("%d",&min2);
printf("Enter the sec2 => ");
scanf("%d",&sec2);
printf("Time is %d %d %d %d %d %d %d %d %d %d %d %d %d",y1,m1,w1,d1,h1,min1,sec1,y2,w2,d2,h2,min2,sec2);
return 0;
}
1.เมื่อกดcomplie และ run แล้ว มันขึ้น Enter the year1 => ค่ะ แล้วได้inputเลข5ไป คือEnter the year1 => 5
2.เมื่อกดenter ก็ขึ้น"Process exited after 5.007 seconds with return value 3221225477" หรือจบการทำงานเลยค่ะหรือไม่แสดงข้อความEnter the month1 => นี้เลยค่ะ
[ภาษาซี] ช่วยแก้โค้ดหน่อยค่ะ
#include <stdio.h>
#include <stdlib.h>
int main()
{
int y1,m1,w1,d1,h1,min1,sec1,y2,m2,w2,d2,h2,min2,sec2;
printf("Enter the year1 => ");
scanf("%d",y1);
printf("Enter the month1 => ");
scanf("%d",&m1);
printf("Enter the week1 => ");
scanf("%d",&w1);
printf("Enter the day1 => ");
scanf("%d",&d1);
printf("Enter the hour1 => ");
scanf("%d",&h1);
printf("Enter the min1 => ");
scanf("%d",&min1);
printf("Enter the sec1 => ");
scanf("%d",&sec1);
printf("Enter the year2 => ");
scanf("%d",&y2);
printf("Enter the month2 => ");
scanf("%d",&m2);
printf("Enter the week2 => ");
scanf("%d",&w2);
printf("Enter the day2 => ");
scanf("%d",&d2);
printf("Enter the hour2 => ");
scanf("%d",&h2);
printf("Enter the min2 => ");
scanf("%d",&min2);
printf("Enter the sec2 => ");
scanf("%d",&sec2);
printf("Time is %d %d %d %d %d %d %d %d %d %d %d %d %d",y1,m1,w1,d1,h1,min1,sec1,y2,w2,d2,h2,min2,sec2);
return 0;
}
1.เมื่อกดcomplie และ run แล้ว มันขึ้น Enter the year1 => ค่ะ แล้วได้inputเลข5ไป คือEnter the year1 => 5
2.เมื่อกดenter ก็ขึ้น"Process exited after 5.007 seconds with return value 3221225477" หรือจบการทำงานเลยค่ะหรือไม่แสดงข้อความEnter the month1 => นี้เลยค่ะ