![]() | ภาษาซี (Turbo C++ : Computer Language) | ![]() |
ผู้สอน : อ.อติชาต หาญชาญชัย ผู้สอน : อ.บุรินทร์ รุจจนพันธุ์ MSDN of C++ : Output File Stream function Download Site : Borland C++ 5.5 ! . To Install BCC55 #1, #2, #3 # Old Compiler : Turbo C++ 3.0 . . # แนวคิดการสอนเขียนโปรแกรม |
What is C language?
|
|
Visual Studio 8
http://msdn.microsoft.com/en-us/library/59zy697d(VS.80).aspx
start : Visual Studio 2005 Command Prompt
DOS> cl cl0101.cpp
DOS> cl /clr cl0101.cpp
- ถ้า #include <iostream> ต้องใช้ /clr
- /clr ทำให้มีการเรียกใช้ Incremental Linker
- ให้ใช้ getchar() แทน getch()
- ใช้ getchar() จะต้อง #include <stdio.h>
- ใช้ system("PAUSE") จะต้อง #include <stdlib.h>
- ถ้าใช้ cout ต้อง
#include <iostream> และ using namespace std; // for cout
จึงจะใช้ cout << "a" << endl;
แต่ถ้า #include |
ตัวแปลภาษา (Compiler) BCC 5.5.1|
| Download Site :
|
ตัวแปลภาษา (Compiler) TurboC 3.0|
| Download Site : TurboC 3.0 3 MB วิธีแก้ปัญหา |
| บทเรียนพิเศษ (Extra Lesson) |
โปรแกรมค้นหาตัวอักษรใน string
หัวหน้าผมใช้โปรแกรมลักษณะนี้ออกข้อสอบ จึงต้องทดสอบโปรแกรม เตรียมสอนนักศึกษา
#include <iostream.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
main(void) {
clrscr();
char string[6];
char *ptr, z=z;
strcpy(string, "abcdef");
ptr = strchr(string, z);
if (strlen(ptr) == 0) cout << "not found z";
ptr = strchr(string, c);
if (strlen(ptr) > 0) cout << "found c";
getch();
}
|
|
ศึกษาเรื่อง date เพราะมีนักศึกษาคนหนึ่งโทรมาถาม
พบตัวอย่างที่ http://www.cs.duke.edu/~ola/ap/dates/ |
นำตัวแปร myMonth myDate และ myYear ไปใช้ต่อได้
#include <time.h>
#include <stdio.h>
#include <conio.h>
void main() {
clrscr();
static struct tm timeHolder;
static struct tm *date = &timeHolder;
time_t tloc;
time(&tloc);
date = localtime(&tloc);
int myMonth = date->tm_mon + 1;
int myDay = date->tm_mday;
int myYear = date->tm_year + 1900;
printf("%d%d%d",myMonth,myDay,myYear);
getch(); // 9122007 (9 Dec 2007)
}
|
อีเมลจากเพื่อนชาวไทย ที่ให้คำแนะนำทีมงาน
1. คุณศร [sorn_kkc@hotmail.com] : ส่งโปรแกรมนี้มาให้ผมตอบคำถาม คำถามของคุณศร : เขียนโปรแกรมส่งข้อมูลผ่าน port printer โดยควบคุมหลอด LED ปรากฎว่าไม่ได้ผลตามโปรแกรมที่เขียน ผมก็ไม่รู้ จึงค้นคว้าเพิ่มเติม และไปเข้าใจที่ หนังสือภาษาซี ของ ดอนสัน ปงผาบ อ.คณะเทคโนโลยีอุตสาหกรรม ม.ราชภัฏลำปาง (donson@lpru.ac.th) จึงเข้าใจว่า LED คืออะไร .. ผลการทดสอบต่อวงจรครั้งแรกในชีวิต ก็ได้มา 7 ภาพดังที่เห็น พร้อมแผลพุพองที่นิ้วกลางซ้ายอีกแผล
http://www.etteam.com/downloadf.html (มี compiler manual และ code แก้ปัญหา) http://www.beyondlogic.org/spp/parallel.htm (Have detail of pin number) http://www.machinegrid.com/content/view/30/84/ (แสดงการประยุกต์กับมอเตอร์) http://www.nelnickrobotics.com/printer_port.html (ภาพวงจรการเชื่อมต่ออุปกรณ์) http://my.tele2.ee/chipmcu/ing/prog705j.htm (อ่าน e-prom จาก printer port)
ตัวอย่างภาษาซี กับส่งข้อมูลออกทาง Printer Port ที่ http://www.thaiall.com/printer | |||||||||