Run C++ Program on Browser

now create the program   and save in /usr/lib/cgi-bin

the program save with any name like(g.cpp)

#include <iostream>

using namespace std;

int main()

{

int a,b,c;

a=9;b=8;

c=a+b;

cout<<c;

}

now compile the program

g++ /usr/lib/cgi-bin/g.cpp

now you see the executable file in this folder

a.out

2)open the browser and type this

https://localhost/cgi-bin/

3)now run this command on browser

https://localhost/cgi-bin/a.out

ok your program is run on browser

see the output is 17

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s