Merging HTML and C++: Realizing the combination of HTML and C++
P粉642919823
2023-09-02 17:11:20
<p>I am new to both html and c, but have a lot of knowledge in c#. I just wrote my first 100% C program, a small banking system, and need a little help integrating the html into it.
For example, how to display funds in html? </p>
<p>IDE Clion. </p>
<pre class="brush:php;toolbar:false;">int press;
int newFunds;
cout << "Available Funds ";
cout << funds;
cout << "$ \n";
cout << "Press 1 to withdraw \n";
cout << "Press 2 to deposit \n";
cin >> press;
if(press == 1) {
cout << "amount";
cin >> withdraw;
funds -= withdraw;
newFunds = withdraw;
if(funds < 0) {
funds = newFunds;
cout << "Insufficient funds! ";
}
else {
cout << "remaining funds ", cout << funds, cout << "$ \n";
}
}
else if(press == 2) {
cout << "Amount\n";
cin >> deposit;
funds = deposit;
cout << "Funds ";
cout << funds;
cout << "$";
}
if(press > 2) {
cout << "Invalid";
}
return 0;
}</pre>
<p>I welcome any suggestions! </p>
<p>I tried looking up some tutorials but they weren't very good! </p>
C and HTML cannot be connected just by creating a localhost web server. To establish a "connection" between them, you need a C API to interact with the server and your C program. FastCGI Protocol Simple and easy to use for beginners, but may not be the best choice for more professional projects. Check out information about FastCGI, an API for C. Here's a useful GitHub link I recommend getting started: https://github.com/eddic/fastcgipp.