Name Card Project with C Programming using OnlineGDB & Dev C++ IDE

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

Figure 1. GBD Online Debugger | Compiler IDE




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

Figure 2. Name Card using printf function on Online GDB

4. C Programming on Dev C++ IDE
Type Source Code –> Execute –> Compile & Run (F11) –> Save as NameCardPrintf.c

Figure 3. Printf Function on Dev C++ IDE




Output

Figure 4. Name Card using printf function 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

Figure 5. Name Card Design with Text File

3. C Programming on Online GDB
Open https://www.onlinegdb.com/ –> Select Language: C –> Type Source Code

Figure 6. Name Card using File Operations on Online GDB

Upload File –> NameCard.txt

Figure 7. Upload File NameCard.txt on Online GDB




Run Source Code

Figure 8. Name Card File Project Output on Online GDB

4. C Programming on Dev C++ IDE
Save as NameCard.txt in Name Card Project Folder

Figure 9. NameCard.txt in Name Card Project Folder

Type Source Code –> Execute –> Compile & Run (F11) –> Save as NameCardFile.c

Figure 10. Name Card using File Operations Source Code




Output

Figure 11. Name Card using File Operations Output




Aj. NesT The Series on sabemailAj. NesT The Series on sabfacebookAj. NesT The Series on sabinstagramAj. NesT The Series on sabtwitterAj. NesT The Series on sabyoutube
Aj. NesT The Series
at GlurGeek.Com
Lecturer, Blogger, Traveler, and Software Developer ที่ชอบอ่านบทความใหม่ๆ ตลอดเวลา ชอบหาวิธีสร้าง Inspiration เป็นชีวิตจิตใจ มีความฝันอยากทำ CREATIVE PRODUCT ที่สามารถเปลี่ยนแปลงโลกให้ดีขึ้น และอยากถ่ายรูปสถานที่ท่องเที่ยวรอบโลก สอนหนังสือ ชอบแลกเปลี่ยนความรู้ และเขียน WEBSITE, MOBILE APP, GAME, ETC ที่เป็นประโยชน์กับโลกใบนี้

Leave a Reply

Copyright © 2021 GlurGeek.Com. All Rights Reserved.