คือ....... มัน output ไม่ออกอ่ะครับ
บรรทัดที่ ใส่ *** ไว้อ่ะครับ
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <iostream>
int i;
typedef struct{
char id;
char name;
char surname;
char id_subjects;
char name_subjects;
float work;
float midterm;
float final;
}student_info;
createfile()
{
FILE *student_reference;
student_reference = fopen("C:\\Users\\Avh_CT\\Desktop\\system\\student_info.dat","w");
if(student_reference == NULL)
{
printf("Cannot Open Student_info.dat\n");
exit(1);
}
fclose(student_reference);
}
input()
{
student_info student[100];
FILE *student_reference;
student_reference = fopen("C:\\Users\\Avh_CT\\Desktop\\system\\student_info.dat","r+");
if(student_reference == NULL)
{
printf("Cannot Open Student_info.dat\n");
exit(1);
}
printf("\t------------------------------------------\n");
printf("\t\t C Programing : File");
printf("\n\t\t ID :60140365");
printf("\n\t\tCr.Kittipong Thoonphanupraphan");
printf("\n\t------------------------------------------\n");
printf("\t Enter ID Student : ");
scanf("%s",&student[i].id);
printf("\n");
printf("\t Enter FirstName : ");
scanf("%s",&student[i].name);
printf("\n");
printf("\t Enter LastName : ");
scanf("%s",&student[i].surname);
printf("\n");
printf("\t Enter ID Subject : ");
scanf("%s",&student[i].id_subjects);
printf("\n");
printf("\t Enter Name Subjects : ");
scanf("%s",&student[i].name_subjects);
printf("\n");
printf("\t Enter Work Score : ");
scanf("%f",&student[i].work);
while (student[i].work>20||student[i].work<0)
{
printf("\n\t Invalid Work Score.");
printf("\n");
printf("\t Enter Work Score : ");
scanf("%f",&student[i].work);
}
printf("\n");
printf("\t Enter Midterm Score : ");
scanf("%f",&student[i].midterm);
while (student[i].midterm>40||student[i].midterm<0)
{
printf("\n\t Invalid Midterm Score.");
printf("\n");
printf("\t Enter Midterm Score : ");
scanf("%f",&student[i].midterm);
}
printf("\n");
printf("\t Enter Final Score : ");
scanf("%f",&student[i].final);
while (student[i].final>40||student[i].final<0)
{
printf("\n\t Invalid Final Score.");
printf("\n");
printf("\t Enter Final Score : ");
scanf("%f",&student[i].final);
}
printf("\t------------------------------------------\n");
fwrite(&student[i], sizeof(student_info), 1 , student_reference);
fclose(student_reference);
}
show()
{
student_info student[100];
FILE *student_reference;
student_reference = fopen("C:\\Users\\Avh_CT\\Desktop\\system\\student_info.dat","r");
if(student_reference == NULL)
{
printf("Cannot Open Student_info.dat\n");
exit(1);
}
fread(&student[i], sizeof(student_info), 1 , student_reference);
printf("|-----------------------------------------------------------|");
printf("| |");
printf("%s",student[i].name); ****** ปัญหา ******
printf("s");
printf("| |");
printf("|-----------------------------------------------------------|");
fclose(student_reference);
}
int main()
{
createfile();
input();
show();
printf("\t------------------------------------------\n");
printf("\t\t End the work!");
printf("\n\t------------------------------------------");
printf("\n");
}
ภาษาซี เรื่องไฟล์ ช่วยหน่อยครับ
แนะนำ สอบถาม ภาษา C สำหรับผู้เริ่มต้น ภาษา Java ภาษา Python
Moderator: mindphp, ผู้ดูแลกระดาน
ไปที่
- Webboard
- Programming - PHP
- Joomla Development
- ปัญหาการใช้ phpBB3, SMF, Joomla, Wordpress, CMS CRM
- JavaScript & Jquery Ajax
- HTML CSS
- SQL - Database
- Programming - C/C++ & java & Python
- Mobile Programming - Android, iOS, Window Phone
- PHP News
- ถาม - ตอบ คอมพิวเตอร์
- ถาม - ตอบ ธุรกิจ กฏหมาย ภาษี บัญชี
- พูดคุยเรื่องทั่วไป จับฉ่าย
- ปัญหาการใช้ MooZiiCart
- International Webboard
- English Language
- Chinese Language - 简体中文
- korean Language - 한국어
- Bahasa Language
- Result Center
- Share Knowledge
- PHP Knowledge
- Joomla Developing Knowledge
- Wordpress Developing Knowledge
- phpBB Developing Knowledge
- Jquery & Ajax Knowledge
- Python Knowledge
- XML Knowledge
- SQL Knowledge
- PostgreSQL
- Mobile Application Developing- Android, iOS
- Linux - Web Server
- Mindphp Videoman
- IOT - Internet of things
- CSS Knowledge
- Booststap Knowledge
- Graphic design
- Software testing
- Joomla user Guide Knowledge
- Wordpress user Guide Knowledge
- Magento user Guide Knowledge
- phpBB user Guide Knowledge
- Accounting software & ERP โปรแกรมบัญชี ระบบอีอาร์พี
- Microsoft Office Knowledge & line & Etc
- Software Review
- PHPBB3.0 Mod Review
- phpBB 3.1 Extension Review
- phpBB 3.1 Mindphp Extension Review
- Joomla Extension Review
- Joomla MindPHP Extension Review
- Web Hosting Review - Free Host Share Host VPS
- AJAX Javascript Library - jQuery
- Free PHP Code Download script
ผู้ใช้งานขณะนี้
กำลังดูบอร์ดนี้: 5 และ บุคคลทั่วไป 0 ท่าน