-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathweb.c
More file actions
84 lines (63 loc) · 2.05 KB
/
Copy pathweb.c
File metadata and controls
84 lines (63 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include<stdio.h>
main()
{
char title[50],fname[20],logo[20]; //variable declaration
int choice;
char h[50];
char link[50],q[50],c[100],name[20];
int head,parts,i;
FILE *f; // file
f=fopen("web.html","w"); //file open
fprintf(f,"<html><head><title>");
printf("Enter the title of the website:"); //Title of website
scanf("%s",title);
fprintf(f,"%s</title>",title);
printf("\n Custom CSS file \n Press 1 to enter custom css file\nPress 0 to use default css file\n"); // css f ile
printf("enter your choice:");
scanf("%d",&choice);
if(choice == 1)
{
printf("\nEnter the file name:");
scanf("%s",fname);
fprintf(f,"<link rel=\"stylesheet\" type=\"text/css\" href=\"%s.css\"></head>",fname);
}
if(choice == 0)
{
fprintf(f,"<link rel=\"stylesheet\" type=\"text/css\" href=\"index1.css\"></head>");
}
fprintf(f,"<body>"); //body starts
printf("\nEnter the heading of the site:");
scanf("%s",name);
fprintf(f,"<h1>%s</h1>",name);
printf("\nEnter the logo image with extension:"); // logo of the site
scanf("%s",logo);
fprintf(f,"<div id=logo><img src=\"%s\">",logo); //div id=logo
fprintf(f,"</div>");
printf("How many headings/navigation keys u want to enter:"); //Headings
scanf("%d",&head);
fprintf(f,"<div id=\"nav\"> <ul>");
for (i=0;i<head;i++)
{
printf("\nEnter the %d heading:",i+1);
scanf("%s",h);
printf("Enter the link in heading %d:",i+1);
scanf("%s",link);
fprintf(f,"<li><a herf=\"%s\">%s</a></li>",link,h);
}
fprintf(f,"</ul></div>");
fprintf(f,"<div id=\"content\">"); // div id =content
printf("\nHow many posts content u want to add:");
scanf("%d",&parts);
for(i=0;i<parts;i++)
{
printf("\n Enter heading:");
scanf("%s",q);
printf("\n Enter content:");
scanf("%s",c);
fprintf(f,"<h4>%s</h4><br>",q);
fprintf(f,"%s",c);
}
printf("thanks :) :) now open browser:");
fprintf(f,"</div></body></html");
fclose(f);
}