<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BioGem.Org &#187; CPP</title>
	<atom:link href="http://www.biogem.org/tag/cpp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.biogem.org</link>
	<description>Bioinformatics Blog Site..</description>
	<lastBuildDate>Sat, 03 Jul 2010 07:57:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Running C or C++ program in Linux</title>
		<link>http://www.biogem.org/2009/12/running-c-or-c-program-in-linux.html</link>
		<comments>http://www.biogem.org/2009/12/running-c-or-c-program-in-linux.html#comments</comments>
		<pubDate>Fri, 04 Dec 2009 02:11:57 +0000</pubDate>
		<dc:creator>Ashok Kumar</dc:creator>
				<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[CPP]]></category>

		<guid isPermaLink="false">http://www.biogem.org/?p=90</guid>
		<description><![CDATA[Steps to run C program in Ubuntu:
1. Go to Applications &#62; Accessories &#62; Terminal, to open terminal window.
2. Type the following in command line
sudo gedit first.c
3. Enter the code bellow in the editor.
/* Program first.c */
#include&#60;stdio.h&#62;
main()
{
printf(&#8221;Hello World.\n&#8221;);
}
4. Save the file and close to return to terminal window.
5. Firstly compile the code using the following command
cc [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-family: georgia,palatino;"><span style="font-size: small;"><span style="color: #ff0000;"><span style="font-size: medium;"><strong>Steps to run C program in Ubuntu:</strong></span></span></span></span></p>
<p><span style="font-family: georgia,palatino;">1. Go to <em>Applications</em> &gt; <em>Accessories</em> &gt; <em>Terminal</em>, to open terminal window.</span></p>
<p><span style="font-family: georgia,palatino;">2. Type the following in command line</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>sudo gedit first.c<span id="more-90"></span></em></span></span></p>
<p><span style="font-family: georgia,palatino;">3. Enter the code bellow in the editor.</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>/* Program first.c */<br />
#include&lt;stdio.h&gt;<br />
main()<br />
{<br />
printf(&#8221;Hello World.\n&#8221;);<br />
}</em></span></span></p>
<p><span style="font-family: georgia,palatino;">4. Save the file and close to return to terminal window.</span></p>
<p><span style="font-family: georgia,palatino;">5. Firstly compile the code using the following command</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>cc -c first.c</em></span></span></p>
<p><span style="font-family: georgia,palatino;">That would produce an object file you may need to add to the library.</span></p>
<p><span style="font-family: georgia,palatino;">6. Then create an executable using the following command</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>cc -o first first.c</em></span></span></p>
<p><span style="font-family: georgia,palatino;">7. Now run this executable using the following command</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>./first</em></span></span></p>
<p><span style="font-family: georgia,palatino;">8. Output should show as follows</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #ff0000;"><em>Hello World.<br />
</em></span></span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #ff0000;"><span style="font-size: medium;"><strong>Steps to run C++ program in Ubuntu:</strong></span></span></span></p>
<p><span style="font-family: georgia,palatino;">1. Go to <em>Applications</em> &gt; <em>Accessories</em> &gt; <em>Terminal</em>, to open terminal window.</span></p>
<p><span style="font-family: georgia,palatino;">2. Type the following in command line</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>sudo gedit first.cpp</em></span></span></p>
<p><span style="font-family: georgia,palatino;">3. Enter the code bellow in the editor.</span></p>
<p><span style="font-family: georgia,palatino;"><em><span style="color: #0000ff;">/* Program first.cpp */<br />
#include&lt;iostream&gt;<br />
main()<br />
{<br />
std::cout&lt;&lt;&#8221;Hello World.&#8221;&lt;&lt;std::endl;<br />
}</span></em></span></p>
<p><span style="font-family: georgia,palatino;">4. Save the file and close to return to terminal window.</span></p>
<p><span style="font-family: georgia,palatino;">5. Now compile the code using the following command</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>g++ first.cpp -o second</em></span></span></p>
<p><span style="font-family: georgia,palatino;">6. Then run this executable using the following command</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>./second</em></span></span></p>
<p><span style="font-family: georgia,palatino;">7. Output should show as follows</span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #ff0000;"><em>Hello World.<br />
</em></span></span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #ff0000;"><strong><span style="font-size: medium;">A sample factorial program in C</span></strong></span></span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #0000ff;"><em>/* Factorial using C */<br />
#include&lt;stdio.h&gt;<br />
int main()<br />
{<br />
int i,n,f=1;<br />
printf(&#8221;\nEnter the number: &#8220;);<br />
scanf(&#8221;%d&#8221;,&amp;n);<br />
for(i=1;i&lt;=n;i++)<br />
{<br />
f=f*i;<br />
}<br />
printf(&#8221;\nFactorial of %d is %d \n\n&#8221;,n,f);<br />
}</em><br />
</span></span></p>
<p><span style="font-family: georgia,palatino;"><strong>Output:</strong><br />
<span style="color: #0000ff;"><em><br />
$ sudo gedit factorial.c<br />
$ cc -c factorial.c<br />
$ cc -o factorial factorial.c<br />
$ ./factorial</em></span></span></p>
<p><span style="font-family: georgia,palatino;"><span style="color: #ff0000;"><em>Enter the number: 6<br />
Factorial of 6 is 720</em></span></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.biogem.org/2009/12/running-c-or-c-program-in-linux.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
