1 3 char name10 Array name index Array
- Slides: 64
1. 3 การเขยนคำสงรบขอมล ตวอยาง char name[10]; Array แบบไมม เชน name; index Array แบบม index เชน name[5 ; [ main() }char position[10 ; [ int radius; scanf(“%s”, position; ( scanf(“%c”, &position[1; ([ scanf(“%d”, &radius; ( {
Try it ! Input : Department : Business Information System scanf(“%[a-z. A-Z]”, dep); Output : Department เพราะ input มเวนวรรค
Try it ! Input : Department : Business Information System 56 scanf(“%[0 -9 a-z. A-Z]”, dep); Output : Department
Try it ! Input : Department : Business Information System 56 scanf(“%[a-z. A-Z]%[0 -9]”, dep); Output : Department
Try it ! Input : Department : Business Information System 56 scanf(“%[^0 -9]”, dep); Output : Department : Business Information System
Try it ! Input : Department : Business Information System 56 scanf(“%[^a-z]”, dep); Output : D
1. 3 การเขยนคำสงรบขอมล ตวอยาง #include <stdio. h> void main() { float b, h, area ; printf("Input Base : > "); scanf("%f", &b); printf("Input Height : > "); scanf("%f", &h); area = 0. 5*b*h ; printf("Area of triangle is %5. 2 f", area); } Input Base : > 12. 0 Input Height : > 6. 0 Area of triangle is 36. 00 Input Base : > 3. 2 Input Height : > 1. 2 Area of triangle is 1. 92
2. 2 การเขยนคำสงแสดง ผลขอมล #include <stdio. h> void main() { printf("Welcome to RMUTI "); printf("Department of Information System"); } ผลการทำงาน Welcome to RMUTI Department of Information System
2. 2 การเขยนคำสงแสดง ผลขอมล ตวอยาง #include <stdio. h> Backslash n ขนบรรทดใหม void main() { printf("Welcome to RMUTIn"); n printf("Department of Information System"); } ผลการทำงาน Welcome to RMUTI Department of Information System
การเขยนคำสงแสดง ผลขอมล รปแบบคำสง การแสดงผลโดยใช Format Code printf(“ขอความ format code”, variable list) int number = 50; printf(“my number is %d”, number); String Format Code my number is 50
2. 2 การเขยนคำสงแสดง รปแบบคำสง printf(“ขอความ Control Format Code”, variable ผลขอมล ตวอยาง list) my salary = 4750 th. B float salary, tax = 0. 05; salary = 50000 – (50000 * 0. 05); printf(“COMPANY n my salary = %f th. B”, salary); String Control String Format Code
2. 2 การเขยนคำสงแสดง รปแบบคำสง ผลขอมล ตวอยาง printf(“ขอความ Control Format Code”, var 1, var 2) float salary, tax = 0. 05; tax = 0. 05 my salary = 4750. 000000 th. B salary = 50000 – (50000 * 0. 05); printf(“tax = %f my salary = %f th. B”, tax, salary);
2. 2 การเขยนคำสงแสดง รปแบบคำสง ผลขอมล ตวอยาง printf(“ขอความ Control Format Code”, value, var 1) float salary, tax = 0. 05; tax = 0. 05 my salary = 4750. 0000 th. B salary = 50000 – (50000 * 0. 05); printf(“tax = %f my salary = %f th. B”, 0. 05, salary);
2. 2 การเขยนคำสงแสดง รปแบบคำสง ผลขอมล printf(“ขอความ ตวอยาง Control Format Code”, String, var 1) float salary, tax = 0. 05; PATCHARA salary = 4750 th. B salary = 50000 – (50000 * 0. 05); printf(“%s salary = %f th. B”, “ PATCHARA”, salary);
Try it ! #include<stdio. h> void main(){ float num=10; printf("%f", num); } ����� 10. 000000
Try it ! #include<stdio. h> void main(){ float num=10; printf("%. 3 f", num); } ����� 10. 000
Try it ! #include<stdio. h> void main(){ float num=10; printf("%7. 3 f", num); } ����� _10. 000
Try it ! #include<stdio. h> void main(){ char dep[5]="BIS"; printf("University: %s n Department: %s", "KKC. RMUTI", dep); } ����� University: KKC. RMUTI Department BIS
Try it ! #include<stdio. h> void main(){ char dep[5]="BIS"; int money; money = 258; printf("Department: %s money: %5 d", dep, money); } ����� Department BIS money _ _ 258
Try it ! #include<stdio. h> void main(){ char dep[5]="BIS"; int money; money = 258; printf("Department: %s money: %5 d", dep, money); } ����� Department BIS money _ _ 258
- Const name void
- Auto break case char
- Struct in c
- Char name[20]
- Char* name
- Char name[20]
- Struct student
- Struct student char *name
- Char name 20
- Name all rays
- Optical fibre
- Primary index is dense or sparse
- Bacteriological index
- Physical quality of life index and human development index
- Diff between step index and graded index fiber
- How to calculate simpson's diversity index
- Liquid limit of soil formula
- Clustered index và non clustered index
- Primitive vs reference types java
- Public static void main
- Lga pin
- Deklarasi array x adalah double a 2 4 5
- Jagged array vs multidimensional array
- Associative array vs indexed array
- Difference between broadside and endfire array
- Latik adalah
- Array yang sangat banyak elemen nol-nya
- Python 2 dimensional array
- Photovoltaic array maximum power point tracking array
- An element is accessed by indexing the array name
- Array name is
- Char far in c
- Unsigned char 255
- Charcont
- Switch statement c++
- Int float
- Int kaç byte
- Int char float
- Char short
- Matlab double to string
- Linguagem c strings
- Difference array and string
- Int main int argc char argv
- Signed char
- 1 char kaç byte
- Integer real char string boolean
- 123
- Boolcenter
- Modifier switch
- Ejemplo de char
- Auto break case char
- 1 char kaç byte
- Short int long
- Int char float
- Char 8 bit
- 1 char = byte
- V int
- Character variable
- Void fun(int *ptr)
- Int (*)(bool, char)
- Char dham
- Seou;
- Int (*)(bool, char)
- Application what
- Contoh pengisytiharan pemboleh ubah