Question

What is wrong with my code? It needs to open in html. A line, circle, and...

What is wrong with my code?

It needs to open in html. A line, circle, and a rect.

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main()

{

printf("!DOCTYPE html> \n");

printf("<html> \n");

printf("<body> \n");

printf("<svg height='1000' width='1000' style='stroke-width: 0px; background-color: rgb(128, 0, 128);'> \n");

printf(" \n");

printf("<circle cx='160' cy='200' r='172' stroke=\"black\" stroke-width=\"4\" fill=\"red\" /> \n");

printf(" \n");

printf(" \n");

printf(" \n");

printf("<rect x=\"50\" y=\"300\" width=\"150\" height=\"150\" \n");

printf(" fill='rgb(344,21,377)' /> \n");

printf(" \n");

printf(" \n");

printf(" \n");

printf("<line x1=\"3\" y1=\"67\" x2=\"700\" y2=\"700\" style=\"stroke:rgb(0,0,255);stroke-width:2\" /> \n");

printf(" \n");

printf(" \n");

printf("</svg> \n");

printf("</body> \n");

printf("</html> \n");

printf("\n");

return 0;

}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You need to make html file and execute the html file...

Here is code:

#include <stdio.h>

#include <stdlib.h>

#include <time.h>

int main()

{

FILE *pFile;

pFile = fopen("data.html", "w");

// fprintf(pFile2, "%s", buffer);

// close file

fprintf(pFile,"%s","<!DOCTYPE html> \n");

fprintf(pFile,"%s","<html> \n");

fprintf(pFile,"%s","<body> \n");

fprintf(pFile,"%s","<svg height='1000' width='1000' style='stroke-width: 0px; background-color: rgb(128, 0, 128);'> \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s","<circle cx='160' cy='200' r='172' stroke=\"black\" stroke-width=\"4\" fill=\"red\" /> \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s","<rect x=\"50\" y=\"300\" width=\"150\" height=\"150\" \n");

fprintf(pFile,"%s"," fill='rgb(344,21,377)' /> \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s","<line x1=\"3\" y1=\"67\" x2=\"700\" y2=\"700\" style=\"stroke:rgb(0,0,255);stroke-width:2\" /> \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s"," \n");

fprintf(pFile,"%s","</svg> \n");

fprintf(pFile,"%s","</body> \n");

fprintf(pFile,"%s","</html> \n");

fprintf(pFile,"%s","\n");

fclose(pFile);

return 0;

}

Output:

Add a comment
Know the answer?
Add Answer to:
What is wrong with my code? It needs to open in html. A line, circle, and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • <!-- DOCTYPE declaration --> <!DOCTYPE html> <!-- HTML boilerplate code --> <html lang="en">    <!-- head...

    <!-- DOCTYPE declaration --> <!DOCTYPE html> <!-- HTML boilerplate code --> <html lang="en">    <!-- head tag -->    <head>                 <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Social</title>    </head>    <!-- body tag --> <body>                 <style>        .sidenav {            height: 100%;             width: 160px;            position: fixed;            z-index: 1;             top: 0;            left: 0;            background-color:...

  • HTML Canvas: I have given my small html + js mix code below. By this program-...

    HTML Canvas: I have given my small html + js mix code below. By this program- I can just draw line, but after drawing any image I want to save the "image " on my desktop. I understand, I have to make a "button" to SAVE it and later if I want to load the picture, then I have to make a button on the webpage to "LOAD". But I am unable to understand the function I should write for...

  • the is my HTML and CSS code. I didn't attach the image or the CSS file...

    the is my HTML and CSS code. I didn't attach the image or the CSS file because of the space limit. two things I wanted to incorporate on this page are to make "MY TOP 3 MUSIC GENRES" blink using javascript and to make the video links autoplay using javascript both should be using javascript requirement: our professor told us not to use <div> or alert. thank you for your help <!DOCTYPE html> <!-- I used w3school for the formatting...

  • C Programming Question Hi, I have the following code and in my submission I'm supposed to...

    C Programming Question Hi, I have the following code and in my submission I'm supposed to only include function definitions (i.e. implementations) in the file. However, I'm not NOT required to write the main, struct definitions and function prototypes. Could someone help me fix this code? Text Version: #include<stdio.h> #include<stdlib.h> #include <string.h> struct ip_address { int octet_1; int octet_2; int octet_3; int octet_4; }; typedef struct ip_address ip_address_t; void print_ip_address(ip_address_t ip1){ printf("%d.%d.%d.%d", ip1.octet_1,ip1.octet_2,ip1.octet_3,ip1.octet_4); } int is_valid(ip_address_t ip1){ if(ip1.octet_1 < 0...

  • This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName...

    This is a website picture The html and css code is as follow And my problem is as follow use the php and mysql Northwind Customer Database Search List Records All Records CustomerName v CustomerName ContactName Address City PostalCode Search O ASC DESC List All Records Insert Record Country List City CustomerName ContactName Address City PostalCode Country List City Find by IID Find Insert 1 <! DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http:L 3-<head> 4 Kmeta http-equiv-"Content-Type" content-"text/html; charset-utf-8" />...

  • Use the C programming language to complete #include <stdio.h> #include <stdlib.h> #include <float.h> // Declare Global...

    Use the C programming language to complete #include <stdio.h> #include <stdlib.h> #include <float.h> // Declare Global variables here. void array_stats() { // Insert your solution here. } #include <stdlib.h> #include <time.h> int main() { // Simulate the test setup process. srand( time( NULL ) ); for ( int i = 0; i < 32; i++ ) { val[i] = rand(); } val_count = rand(); val_mean = rand(); val_min = rand(); val_max = rand(); // Call submitted code. array_stats(); // Display...

  • How to use C to output this: indigo1 376 % lab9 Capacity = 4 Capacity =...

    How to use C to output this: indigo1 376 % lab9 Capacity = 4 Capacity = 8 0 5 10 15 20 Capacity = 16 0 5 10 15 20 25 30 35 40 Capacity = 32 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 105 110 115 120 125...

  • Can you help with this C programming question. I have provided the skeleton code below along...

    Can you help with this C programming question. I have provided the skeleton code below along with the Stack/Data/Process Class for you to see/reference. Along with the Stack/Data type definition.   **SKELTON CODE** #include #include #include Stack* concat_stack(Stack *s1, Stack *s2) { //your code here return NULL; } **STACK CLASS FOR YOU TO REFERENCE** #include #include #include #include Stack* create_stack(int stack_capacity) { Stack *s = (Stack*) malloc(sizeof(Stack)); if (stack_capacity < 1) { fprintf(stderr, "Error(create_stack): invalid capacity, set to 10\n"); s->capacity =...

  • I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I...

    I NEED HELP WITH DEBUGGING A C PROGRAM! PLEASE HEAR ME OUT AND READ THIS. I just have to explain a lot so you understand how the program should work. In C programming, write a simple program to take a text file as input and encrypt/decrypt it by reading the text bit by bit, and swap the bits if it is specified by the first line of the text file to do so (will explain below, and please let me...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
Active Questions
ADVERTISEMENT