<?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>Basic Programs | Student Projects</title>
	<atom:link href="https://studentprojects.in/category/software-development/cpp/cpp-programs/cpp-basic/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Sat, 10 Dec 2022 04:54:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>How to count set bits in a number</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-count-set-bits-in-a-number/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-count-set-bits-in-a-number/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 14:10:24 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9042</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">First version:

  int CoutSetBits(int Num) {

  for (int count = 0; Num; Num >>= 1) {
    if (Num &amp; 1)
      count++;
  }
  return count;
}

Optimized version:

  int CoutSetBits(int Num) {

  for (int count = 0; Num; count++) {
    Num &amp;= Num - 1;
  }
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-count-set-bits-in-a-number/">How to count set bits in a number</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-count-set-bits-in-a-number/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to write a function that finds the last instance of a character in a string</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-finds-the-last-instance-of-a-character-in-a-string/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-finds-the-last-instance-of-a-character-in-a-string/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 14:06:02 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9038</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">char * lastchar(char * String, char ch) {
  char * pStr = NULL;

  // traverse the entire string

  while ( * String++ != NULL) {
    if ( * String == ch)
      pStr = String;
  }

  return pStr;
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-finds-the-last-instance-of-a-character-in-a-string/">How to write a function that finds the last instance of a character in a string</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-finds-the-last-instance-of-a-character-in-a-string/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to generate a Fib numbers</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-generate-a-fib-numbers/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-generate-a-fib-numbers/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 14:04:49 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9036</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">int fib( n ) // recursive version
{
	
	if ( n &lt; 2 )
		return 1;
	else
		return fib ( n –1 ) + fib ( n –2 );

}

int fib( n ) //iterative version
{
	int f1 =1, f2 = 1;

	if ( n &lt; 2 )
		return 1;	
	for ( i = 1; i &lt; N; i++)
	{
		f = f1 + f2;
		f1= f2;
		f = f1;
	}

	return f;
}
</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-generate-a-fib-numbers/">How to generate a Fib numbers</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-generate-a-fib-numbers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to find the factorial of a number</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-find-the-factorial-of-a-number/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-find-the-factorial-of-a-number/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 14:03:50 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9034</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">//
// recursive version
//

int Factorial(int Num) {

  If(num > 0)
  return Num * Factorial(Num– 1);
  else
    return 1;
}

//
// iterative version
//

int Factorial(int Num) {
  int I
  int result = 1;

  for (I = Num; I > 0; I--) {
    result = result * I;
  }

  return result;
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-find-the-factorial-of-a-number/">How to find the factorial of a number</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-find-the-factorial-of-a-number/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to print an integer using only putchar</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-print-an-integer-using-only-putchar/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-print-an-integer-using-only-putchar/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 13:48:51 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9032</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">//
//	recursive version
//
void PrintNum(int Num) {
  if (Num == 0)
    return;
  PrintNum(Num / 10);
  Puthcar(‘0’ + Num % 10);
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-print-an-integer-using-only-putchar/">How to print an integer using only putchar</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-print-an-integer-using-only-putchar/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-takes-in-a-string-parameter-and-checks-to-see-whether-or-not-it-is-an-integer-and-if-it-is-then-return-the-integer-value/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-takes-in-a-string-parameter-and-checks-to-see-whether-or-not-it-is-an-integer-and-if-it-is-then-return-the-integer-value/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 13:45:49 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9028</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">#include &lt;stdio.h>

int strtoint(char * s) {
  int index = 0, flag = 0;

  while ( * (s + index) != '\0') {
    if (( * (s + index) >= '0') &amp;&amp;
      *
      (s + index) &lt;= '9') {
      flag = 1;
      index++;
    } else {
      flag = 0;
      break;
    }
  }

  if (flag == 1)
    return atoi(s);
  else
    return 0;
}

main() {
  printf("%d", strtoint("0123"));
  printf("\n%d", strtoint("0123ii"));
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-takes-in-a-string-parameter-and-checks-to-see-whether-or-not-it-is-an-integer-and-if-it-is-then-return-the-integer-value/">How to write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-write-a-function-that-takes-in-a-string-parameter-and-checks-to-see-whether-or-not-it-is-an-integer-and-if-it-is-then-return-the-integer-value/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to convert a string to the upper case</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-convert-a-string-to-the-upper-case/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-convert-a-string-to-the-upper-case/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 05:17:50 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9020</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">void ToUpper(char * S) {
  while ( * S != 0) {
    * S = ( * S >= 'a' &amp;&amp; * S &lt;= 'z') ? ( * S - 'a' + 'A') : * S;
    S++;
  }
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-convert-a-string-to-the-upper-case/">How to convert a string to the upper case</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-convert-a-string-to-the-upper-case/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to reverse a string</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-reverse-a-string/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-reverse-a-string/#respond</comments>
		
		<dc:creator><![CDATA[Chitra]]></dc:creator>
		<pubDate>Tue, 12 Apr 2022 05:06:59 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">https://studentprojects.in/?p=9016</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<pre class="wp-block-code"><code lang="cpp" class="language-cpp">void ReverseString(char * String) {
  char * Begin = String;
  char * End = String + strlen(String) - 1;
  char TempChar = '\0';

  while (Begin &lt; End) {
    TempChar = * Begin;
    * Begin = * End;
    * End = TempChar;
    Begin++;
    End--;
  }
}</code></pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-reverse-a-string/">How to reverse a string</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/how-to-reverse-a-string/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Find the output of the cpp program</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/find-the-output-of-the-program/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/find-the-output-of-the-program/#comments</comments>
		
		<dc:creator><![CDATA[Arun]]></dc:creator>
		<pubDate>Thu, 29 Nov 2012 10:57:02 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=3758</guid>

					<description><![CDATA[<pre lang="cpp" line="1">
#include "iostream"
using namespace std;
int main()
{
    int i;
    i = 1 + ( 1, 4, 5, 6, 3);
    cout<<i;
}</pre>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/find-the-output-of-the-program/">Find the output of the cpp program</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>What is the output of below code?</p>
<pre lang="cpp" line="1">
#include "iostream"
using namespace std;
int main()
{
    int i;
    i = 1 + ( 1, 4, 5, 6, 3);
    cout<<i;
}</pre>
<p>a) 4<br />
b) 7<br />
c) compile time error<br />
d) no output</p>
<p>The correct answer for this question is b)7 if we perform the arithmetic operation with in parenthesis the largest number from the set is taken for computation of output</p><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/find-the-output-of-the-program/">Find the output of the cpp program</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/find-the-output-of-the-program/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>C++ program to implement Heap sort Algorithm</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/</link>
					<comments>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/#comments</comments>
		
		<dc:creator><![CDATA[Editorial Team]]></dc:creator>
		<pubDate>Tue, 01 Feb 2011 13:38:53 +0000</pubDate>
				<category><![CDATA[Basic Programs]]></category>
		<category><![CDATA[Source Codes]]></category>
		<category><![CDATA[C Programs]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Heap sort]]></category>
		<guid isPermaLink="false">http://studentprojects.in/?p=1240</guid>

					<description><![CDATA[<p>#include const int MAX = 10 ; class array { private : int arr[MAX] ; int count ; public : array( ) ; void add ( int num ) ; void makeheap(int ) ; void heapsort( ) ; void display( ) ; } ; array :: array( ) { count = 0 ; for (</p>
<p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/">C++ program to implement Heap sort Algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></description>
										<content:encoded><![CDATA[<pre lang="cpp">
#include <iostream.h>
const int MAX = 10 ;
class array
{
	private :
		int arr[MAX] ;
		int count ;
	public :
		array( ) ;
		void add ( int num ) ;
		void makeheap(int ) ;
		void heapsort( ) ;
		void display( ) ;
} ;
array :: array( )
{
	count = 0 ;
	for ( int i = 0 ; i < MAX ; i++ )
		arr[MAX] = 0 ;
}
void array :: add ( int num )
{
	if ( count < MAX )
	{
		arr[count] = num ;
		count++ ;
	}
	else
		cout << "\nArray is full" << endl ;
}
void array :: makeheap(int c)
{

	for ( int i = 1 ; i < c ; i++ )
	{
		int val = arr[i] ;
		int s = i ;
		int f = ( s - 1 ) / 2 ;
		while ( s > 0 && arr[f] < val )
		{
			arr[s] = arr[f] ;
			s = f ;
			f = ( s - 1 ) / 2 ;
		}
		arr[s] = val ;
	}
}
void array :: heapsort( )
{
	for ( int i = count - 1 ; i > 0 ; i-- )
	{
		int ivalue = arr[i] ;
		arr[i] = arr[0] ;
		arr[0]=ivalue;
		makeheap(i);

	}
}
void array :: display( )
{
	for ( int i = 0 ; i < count ; i++ )
		cout << arr[i] << "\t" ;
	cout << endl ;
}
void main( )
{
	array a ;

	a.add ( 11 ) ;
	a.add ( 2 ) ;
	a.add ( 9 ) ;
	a.add ( 13 ) ;
	a.add ( 57 ) ;
	a.add ( 25 ) ;
	a.add ( 17 ) ;
	a.add ( 1 ) ;
	a.add ( 90 ) ;
	a.add ( 3  ) ;
	a.makeheap(10) ;
	cout << "\nHeap Sort.\n" ;
	cout << "\nBefore Sorting:\n"  ;
	a.display( ) ;
	a.heapsort( ) ;
	cout << "\nAfter Sorting:\n" ;
	a.display( ) ;
}
</pre><p>The post <a href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/">C++ program to implement Heap sort Algorithm</a> first appeared on <a href="https://studentprojects.in">Student Projects</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-basic/c-program-to-implement-heap-sort-algorithm/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
	</channel>
</rss>
