Posts

Showing posts from December, 2023

HTML & CSS

 <style> *{ padding: 0; margin: 0; } body{ background-image: url("back.jpg"); background-position: center; box-sizing: border-box; font-family: sans-serif; color: white; } .menu-bar { margin-top: 0px; padding: 0px; background: rgb(0,100,0); text-align: center; position: fixed; } .menu-bar ul { display: inline-flex; list-style: none; color: #fff; } .menu-bar ul li { width: 120px; margin: 15px; padding: 15px; } .menu-bar ul li a { text-decoration: none; color: #fff; } .active, .menu-bar ul li:hover { background: #2bab0d; border-radius: 3px; } </style> <body> <div class="menu-bar"> <ul> <li class="active"> <a href="#Home">Home </a></li> <li> <a href="#About Us">About Us </a></li> <li> <a href="#Services">Services </a></li> <li>

File Handle

# include <stdio.h> int main() {     char name[50], address[100], phone[20];     FILE *fp;     fp = fopen("contacts.txt", "w");     if (fp == NULL) {         printf("Error: could not create file.\n");         return 1;     }     printf("Enter name: ");     fgets(name, 50, stdin);     printf("Enter address: ");     fgets(address, 100, stdin);     printf("Enter phone number: ");     fgets(phone, 20, stdin);     fprintf(fp, "Name: %sAddress: %sPhone: %s", name, address, phone);     fclose(fp);     printf("File created successfully.\n");     return 0; }       2.       Write a c program to add some more records in above file. #include <stdio.h> int main() {     char name[50], address[100], phone[20];     FILE *fp;     fp = fopen("contacts.txt", "a");     if (fp == NULL) {         printf("Error: could not open file.\n