Name Card Project with C Programming using Online GDB and Dev C++ IDE
เขียนโปรแกรมการ์ดนามบัตร
Solution 1: Creating Name Card using printf function
1. Open https://www.onlinegdb.com/ –> Select Language: C –> Click Run
2. Name Card Project Source Code
Using printf function for creating Name Card
#include <stdio.h>
int main()
{
printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");
printf("x x\n");
printf("x xxxxxxxxxxxx NAME: Aj.NesT the Series x\n");
printf("x xx xxx xxx xx ID: 1640900989 x\n");
printf("x x O O x STUDY: Computer Programming x\n");
printf("x xxx u xxx HOBBY: Sports x\n");
printf("x x V x DATE: 19 August 2021 x\n");
printf("x xxxxxxxxxx QOUTE: Everything is Possible x\n");
printf("x x\n");
printf("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n");
return 0;
}
3. C Programming on Online GDB
Type Source Code –> Select Language: C –> Click Run
4. C Programming on Dev C++ IDE
Type Source Code –> Execute –> Compile & Run (F11) –> Save as NameCardPrintf.c
Output
Solution 2: Creating Name Card using File Operations
1. Name Card using File Operations Source Code
#include
#define MAX_LEN 128
void print_image(FILE *fptr);
int main(void)
{
char *filename = "NameCard.txt"; //Name Card File
FILE *fptr = NULL;
if((fptr = fopen(filename,"r")) == NULL)
{
fprintf(stderr,"error opening %s\n",filename);
return 1;
}
print_image(fptr);
fclose(fptr);
return 0;
}
void print_image(FILE *fptr)
{
char read_string[MAX_LEN];
while(fgets(read_string,sizeof(read_string),fptr) != NULL)
printf("%s",read_string);
}
2. Creating Name Card Text File with Notepad
Open Notepad –> Type Name Card Design –> Save as NameCard.txt
3. C Programming on Online GDB
Open https://www.onlinegdb.com/ –> Select Language: C –> Type Source Code
Upload File –> NameCard.txt
Run Source Code
4. C Programming on Dev C++ IDE
Save as NameCard.txt in Name Card Project Folder
Type Source Code –> Execute –> Compile & Run (F11) –> Save as NameCardFile.c
Output