Recommended
PDF
PDF
นางสาวกัญญารัตน์ คิดในทางดี
PDF
นางสาวอรอนงค์ เกตุดาว รหัสนิสิต 59170038 กลุ่ม 1
PDF
นางสาวภูริชา พลนิกร-59170111-กลุ่ม1-งานเดี่ยว
DOCX
DOCX
นางสาว จรัญญา-กฤตย์ณัชช์-59170236-กลุ่ม-1
PDF
PDF
PPTX
Tasawuf perbandingan dzauq dan syurb
DOCX
Alan Resume Release Management 16NOV2016
PDF
DOCX
552_rachel_bowe_Project Proposal Draft Final
PPTX
DOCX
PPS
Cuidemos nuestros pensamientos
PPTX
DOCX
Museo de barquisimeto (1)
PDF
Manejo odontologico del paciente hipertenso
DOCX
PPTX
DOC
FlorenceJenna_Dissertation
PPTX
Los medios de comunicacion
DOCX
PDF
CHERISE MARTIN FINaL 1809856
PPTX
PPTX
PPTX
Fraude de Javier Duarte, ex gobernador de Veracruz
DOCX
DOCX
ชื่อนางสาวอรยา กรดเครือ รหัสนิสิต 59670118 กลุ่ม 3301
PDF
More Related Content
PDF
PDF
นางสาวกัญญารัตน์ คิดในทางดี
PDF
นางสาวอรอนงค์ เกตุดาว รหัสนิสิต 59170038 กลุ่ม 1
PDF
นางสาวภูริชา พลนิกร-59170111-กลุ่ม1-งานเดี่ยว
DOCX
DOCX
นางสาว จรัญญา-กฤตย์ณัชช์-59170236-กลุ่ม-1
PDF
PDF
Viewers also liked
PPTX
Tasawuf perbandingan dzauq dan syurb
DOCX
Alan Resume Release Management 16NOV2016
PDF
DOCX
552_rachel_bowe_Project Proposal Draft Final
PPTX
DOCX
PPS
Cuidemos nuestros pensamientos
PPTX
DOCX
Museo de barquisimeto (1)
PDF
Manejo odontologico del paciente hipertenso
DOCX
PPTX
DOC
FlorenceJenna_Dissertation
PPTX
Los medios de comunicacion
DOCX
PDF
CHERISE MARTIN FINaL 1809856
PPTX
PPTX
PPTX
Fraude de Javier Duarte, ex gobernador de Veracruz
DOCX
Similar to Dev c
DOCX
ชื่อนางสาวอรยา กรดเครือ รหัสนิสิต 59670118 กลุ่ม 3301
PDF
PDF
PPT
PDF
PDF
DOCX
ชื่อนางสาวรัตนาวลี ติมุลา รหัสนิสิต 59670108 กลุ่ม 3301
DOCX
ชื่อนางสาวรัตนาวดี ติมุลา รหัสนิสิต 59670107 กลุ่ม 3301
DOCX
ชื่อนางสาวรัตนาวดี ติมุลา รหัสนิสิต 59670107 กลุ่ม 3301
PDF
PDF
PDF
PDF
PDF
PDF
PPT
Slide unit1 พื้นฐานภาษาซี
PDF
PDF
PDF
PDF
Dev c 1. Week 1
โชว์เลขที่ห่างกันอยู่ 4 จานวน แต่ไม่เกิน 10
เฮดชาร์ทหลัก ๆ คือ
#include “stdio.h”
void main()
ไฟล์นามสกุล .h เรียกว่า Header file หรือไฟล์ส่วนหัวที่มีการประกาศรายละเอียดของคาสั่งในภาษา C
int คือการรับค่าจานวนเต็ม
เมื่อเขียนโปรแกรม
#include “stdio.h”
void main()
{
int f;
for(f=1;f <=10; f=f+4)
{
2. 3. 4. Week 2
หาปริมาตรสี่เหลี่ยม
#include <stdio.h>
void main()
{
float w1,w2,h,area;
printf("Please insert side1:");
scanf("%f",&w1);
printf("Please insert side2:");
scanf("%f",&w2);
printf("Please insert to Height:");
scanf("%f",&h);
area = 0.5 *(w1 +w2) *h;
5. printf("Area of trapezoid side:%f side:%f and Height:%f is Area:%f",w1,w2,h,area);
getch();
return0;
}
ใช้ float เพราะเป็นเลขทศนิยม
เมื่อคำนวณออกมำจะได้ผลดังนี้
6. 7. 8. 9. 0.5 คือ ½ ตามสูตรการหา พื้นที่ของสามเหลี่ยมคือ ½ x ฐาน x สูง
ใช้float เพราะเป็นเลขทศนิยม
10. 11. 12. 13. Week 5
ใช้ Char บวกเลข
#include "stdio.h"
void main()
{
char ch1 = 'g';
char ch2 = 'k';
printf("ch1:%d+ ch2:%d= %d",ch1,ch2,ch1+ch2);
if(ch2 > ch1)
{
printf("nCh2more than ch1");
}
printf("nGoodbye");
14. 15. 16. else if((score >=70)&&(score<=74))
printf("Youare Grade B");
else if((score >=65)&&(score<=69))
printf("Youare Grade C+");
else if ((score >= 60)&&(score <= 64))
printf("Youare Grade C");
else if ((score >= 55)&&(score <= 59))
printf("Youare Grade D+");
else if ((score >= 50)&&(score <= 54))
printf("Youare Grade D");
else
printf("Youare Grade F");
printf("nGoodbye");
getch();
return 0;
}
17. 18. 19. case 'p':printf("Papayasalad 120");
break;
case 'c':printf("Chicken Grill 500");
break;
case 't':printf("Tomyumboneyoung 180");
break;
case 's' : printf("Stickyrice 90");
break;
default : printf("nTryagain");
}
}
printf("n--------------^_^----------------");
getch();
return 0;
}
เลือกรายการอาหาร สั่งอาหาร ใช้ switch case
ตามเงื่อนไข ถ้าต้องการ ส้มตา ให้พิมพ์ตัว P
20. 21. #include "stdio.h"
void main()
{
int counter,number,counter1;
for(counter1=1;counter1<=5;counter++)
{
printf("Please insert Number:");
scanf("%d",&number);
for(counter=1;counter<=12;counter++)
{
printf("%dx%d =%dn",number,counter,number * counter);
}
}
printf("nGoodbye");
getch();
return 0;
}
ใช้int เพราะรับค่าที่เป็นจานวนเต็ม
22. 23. 24. 25. 26. กลับตัวหนังสือใช้ array
#include "stdio.h"
#include "conio.h"
#define MAX_VALUE50
void main()
{
int i;
char word[MAX_VALUE];
printf("Enteryour word:");
gets(word);
printf("Reverse ofyourword is:");
for(i=strlen(word)-1;i>=0;i--)
{
printf("%c",word[i]);
}
getch();
return 0;
}
27. 28. ใช้ array ทาสูตรคูณเป็นตารางมี คอลัม
#include"stdio.h"
void main()
{
int table[9][9],i,j,x;
for(i=1;i<=9;i++)
{
for(j=1;j<=9;j++)
{
x= i-1;
table[x][j-1]=i*j;
}
}
29.