question on a c++ program and if it will run right in a HTML browser

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gdarian216
    New Member
    • Oct 2006
    • 57

    question on a c++ program and if it will run right in a HTML browser

    the object of the project was to create a program that inputs multiple lines of integers and outputs them in an HTML table. The negative numbers should be red. The numbers should be printed 3 in a row, one number per column. the fourth column should contain the sum of the numbers in the row (agian if the sum is negative it should be outputed in red). Input should stop when zero is entered, but zero shouldn't be printed if there are any more cells left in the table they should be filled in with empty cells. I have tested the program without the HTML tags and it works pretty good

    So here is my question I am having trouble linking the program(created in ssh in .cpp format) to a input file and when I do how can I take it from there to my computer to view it in a web browser. Since everything is saved on a server at my school.

    Second question, I am new with html so this is my code if you can see any errors let me know.

    thanks

    #include <iostream>
    using namespace std;

    int main() {
    int 1;
    int InputCount=0;
    int RowSize=4;
    int ColumId = 0;
    int sum = 0;



    do
    {
    <table>

    cin >> input;
    if (input == 0)
    break;


    if (input != 0);


    if (InputCount <= RowSize);


    if (InputCount == 0);
    ColumId =(InputCount % RowSize);
    cout << <tr><td>"C1"</td> << <td>"C2" <<</td><td>"C3" << </td><td>"Sum"</td></tr>;
    if (input < 0);
    break;
    cout<< <tr><td><font color=red>input </font></td>;
    cout << <tr><td>input </td>;
    InputCount ++;
    sum += input;
    cin >> input;
    if (input==0)
    break;

    if (InputCount == 1);
    ColumId =(InputCount % RowSize);
    if (input < 0);
    break;
    cout<< <td><font color=red>input </font></td>;
    cout << <td>input</td>;
    InputCount ++;
    sum += input;
    cin >> input;
    if (input==0)
    break;

    if (InputCount == 2);
    ColumId =(InputCount % RowSize);
    if (input < 0);
    break;
    cout<< <td><font color=red>input </font></td>;
    cout << <td>input<td> ;
    InputCount ++;
    sum += input;

    if (InputCount == 3)
    if (sum < 0);
    break;
    cout<< <td><font color=red>input </font></td>;
    cout << <td>sum</td></tr>;

    InputCount = 0;
    sum = 0;

    }while(true);
    while (input==0)
    {
    if (InputCount < RowSize)

    if (InputCount == 0);
    ColumId =(InputCount % RowSize);
    cout << <td>" " </td>;
    InputCount ++;

    if (InputCount == 1);
    ColumId =(InputCount % RowSize);
    cout << <td>" " </td>;
    InputCount ++;

    if (InputCount == 2);
    ColumId =(InputCount % RowSize);
    cout << <td>" " </td>;
    InputCount ++;

    if (InputCount == 3)
    if (sum < 0);
    break;
    cout<< <td><font color=red>input </font></td>;
    cout << <td>sum</td></tr>;



    break;
    }
    cout << endl;
    </table>
    }
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    <table>

    is not compilable C code, for that matter neither is </table>

    many of your cout statements are missing lots of " (double quotes)

    I would assume your program should be writing an html file (alternitively you can output it to stdout).

    Just run your program and canpture the output (or locate the output file). You should be able to load this into any browser.

    However don't forget the basic structure of an HTML file (which you have left out)

    [html]
    <html>
    <head>
    <title>Page Title</title>
    </head>
    <body>

    <!-- Your table code in here -->

    </body>
    </html>
    [/html]

    Comment

    • gdarian216
      New Member
      • Oct 2006
      • 57

      #3
      thanks I appreciate it

      Comment

      Working...