<?xml version="1.0" encoding="utf-8"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>DaniWeb IT Discussion Community - C++</title>
		<link>http://www.daniweb.com/forums/</link>
		<description><![CDATA[Our C++ forum is the place for Q&A-style discussions related to this popular language.  Note we have a separate C forum for non-OOP straight C. Please direct C++ questions directly related to game development to our Game Development forum.]]></description>
		<language>en-US</language>
		<lastBuildDate>Sat, 07 Nov 2009 20:03:25 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.daniweb.com/alphaimages/misc/rss.jpg</url>
			<title>DaniWeb IT Discussion Community - C++</title>
			<link>http://www.daniweb.com/forums/</link>
		</image>
		<item>
			<title>C++ Improving my code - semaphores and mutex</title>
			<link>http://www.daniweb.com/forums/thread236854.html</link>
			<pubDate>Sat, 07 Nov 2009 19:43:40 GMT</pubDate>
			<description><![CDATA[Good day. 
Here's my code. My uncle helped me with it for days but he's now out of the country for 2 weeks. I'm looking for help to improve this project of mine with mutex and semaphores. I've never used them before and I'm a little confused. I'm running this in Ubuntu Linux. Most of the info is in...]]></description>
			<content:encoded><![CDATA[<div>Good day.<br />
Here's my code. My uncle helped me with it for days but he's now out of the country for 2 weeks. I'm looking for help to improve this project of mine with mutex and semaphores. I've never used them before and I'm a little confused. I'm running this in Ubuntu Linux. Most of the info is in the comments in my code.<br />
<br />
I would appreciate your comments and any suggestions. Where would you guys use the semaphores/mutexes?<br />
<br />
Regards,<br />
Håkan<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;semaphore.h&gt;<br />
#include &lt;pthread.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;stdio.h&gt;<br />
#include &lt;unistd.h&gt;<br />
// I'm using g++ to compile this program in Ubuntu 9.04. I use the command ./a.out to run it.<br />
<br />
/*<br />
The program simulates many producers and consumers.<br />
Producers are many and put products in a joint stack. Consumers are also many and take from this same stack.<br />
<br />
Only the product number goes into the stack, nothing else.<br />
<br />
Each producer makes a product number by random from 0..PRODUCTS-1 and puts into the stack. It also raises <br />
<br />
the appropriate element in array &quot;production&quot; by 1.<br />
It also raises the production_total with 1.<br />
<br />
Each consumer looks at the number at the top of each stack.<br />
It raises the counter by 1 over what has been <br />
<br />
&quot;consumed&quot; by that production number by raising the element in the array &quot;consumption&quot;. It also raises <br />
<br />
consumption_total by 1.<br />
<br />
After all the threads have finished all numbers must match.<br />
The array production must look like the array <br />
<br />
consumption and production_total must look like consumption_total.<br />
<br />
The stack must start and end in 0.<br />
<br />
So that can happen I need to synchronize producers and consumers with semaphors and mutex so they will not <br />
<br />
interrupt each other. How can I make the threads end? Where should I put the semaphors and mutex?<br />
*/<br />
<br />
#define PRODUCERS 20<br />
#define CONSUMERS 20<br />
#define PRODUCTS 25<br />
#define STACKMAX 100<br />
<br />
// Producers produce products with a product number between 0..PRODUCTS<br />
<br />
// array production og consumption store numbers for production and consumption<br />
// for each product.<br />
int production[PRODUCTS];<br />
int production_total;<br />
int consumption[PRODUCTS];<br />
int consumption_total;<br />
<br />
int stacksize;&nbsp; // stack can be 0..STACKSIZE-1, I need to use semaphore to watch out for highs and lows...<br />
int stack[STACKMAX];<br />
<br />
// This is how I learnt how to create a semaphore<br />
sem_t semaphore;<br />
<br />
//This is how a semaphore is usually used:<br />
//sem_wait(&amp;semaphore);<br />
//sem_post(&amp;semaphore);<br />
<br />
<br />
//This is how I learnt how to create a mutex - could need more<br />
pthread_mutex_t mutex;<br />
//This is how they're suppoes to be used<br />
//pthread_mutex_lock(&amp;mutex);<br />
//pthread_mutex_unlock(&amp;mutex);<br />
<br />
#define True 1<br />
#define False 0<br />
<br />
// If quitting = True then we're stopping and all threads should exit<br />
int quitting;<br />
<br />
<br />
void* producer(void *arg)<br />
{<br />
&nbsp; &nbsp; int product_number;<br />
<br />
&nbsp; &nbsp; printf(&quot;I'm a producer\n&quot;);<br />
<br />
&nbsp; &nbsp; return NULL;&nbsp; // This needs to be removed so the code will run<br />
<br />
&nbsp; &nbsp; // I need to change this code!&nbsp; Here I need at least one semaphore and probably one mutex.<br />
&nbsp; &nbsp; // The <br />
<br />
if.then.else used here is not the most suitable solution. <br />
&nbsp; &nbsp; while(!quitting)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(stacksize&lt;STACKMAX)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; product_number=rand()%PRODUCTS;&nbsp; // Some number on between 0..PRODUCTS<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Put on stack<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stack[stacksize++]=product_number;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // and record it..<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; production[product_number]++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; production_total++;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;The stack is full!\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return NULL;<br />
}<br />
<br />
void* consumer(void *arg)<br />
{<br />
&nbsp; &nbsp; int product_number;<br />
<br />
&nbsp; &nbsp; printf(&quot;I'm a consumer!\n&quot;);<br />
<br />
&nbsp; &nbsp; return NULL;&nbsp; // This return should delete<br />
<br />
&nbsp; &nbsp; // I need to change this code!&nbsp; Here I need at least one semaphore and probably one mutex.<br />
&nbsp; &nbsp; // The <br />
<br />
if.then.else used here is not the most suitable solution. <br />
<br />
&nbsp; &nbsp; while(!quitting)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(stacksize&gt;0)<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; product_number=stack[--stacksize];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; consumption[product_number]++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; consumption_total++;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;The stack is empty!\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return NULL;<br />
}<br />
<br />
<br />
int main(int argc, char **argv)<br />
{<br />
&nbsp; &nbsp; pthread_t consumer_threads[CONSUMERS];<br />
&nbsp; &nbsp; pthread_t producer_threads[PRODUCERS];<br />
<br />
<br />
&nbsp; &nbsp; // Initialize the semaphore with a value of 1.<br />
&nbsp; &nbsp; // Note the second argument: passing zero denotes<br />
&nbsp; &nbsp; // that the semaphore is shared between threads (and<br />
&nbsp; &nbsp; // not processes).<br />
&nbsp; &nbsp; if(sem_init(&amp;semaphore, 0, 1))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not initialize a semaphore\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Initialize the mutex<br />
&nbsp; &nbsp; if(pthread_mutex_init(&amp;mutex, NULL))<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Unable to initialize a mutex\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Null random generator<br />
&nbsp; &nbsp; srand(0);<br />
<br />
&nbsp; &nbsp; // Null all counters<br />
&nbsp; &nbsp; stacksize=0;<br />
&nbsp; &nbsp; consumption_total=0;<br />
&nbsp; &nbsp; production_total=0;<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  consumption[i]=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  production[i]=0;<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Consumers can look at this global variable to see if producers have stopped producing&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // and it's <br />
<br />
safe to quit<br />
&nbsp; &nbsp; quitting=False;<br />
<br />
&nbsp; &nbsp; // Print initial values<br />
&nbsp; &nbsp; printf(&quot;stacksize (should be 0) = %i\n&quot;,stacksize);<br />
&nbsp; &nbsp; printf(&quot;production_total = %i\n&quot;,production_total);<br />
&nbsp; &nbsp; printf(&quot;consumption_total = %i (needs to match production)\n&quot;,consumption_total);<br />
<br />
&nbsp; &nbsp; printf(&quot;Production array broken down:\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,production[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
&nbsp; &nbsp; printf(&quot;Consumption array broken down (needs to match production array):\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,consumption[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
<br />
&nbsp; &nbsp; // Start the producer<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for(int i = 0; i &lt; PRODUCERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_create(&amp;producer_threads[i], NULL, &amp;producer, NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not create thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // Start the consumer<br />
<br />
&nbsp; &nbsp; int thread_count=0;<br />
<br />
&nbsp; &nbsp; for(int i = 0; i &lt; CONSUMERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_create(&amp;consumer_threads[i], NULL, &amp;consumer, NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not create thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; // The main program sleeps for a while<br />
&nbsp; &nbsp; // then puts the global variable qutting = True , by that all consumers and producers <br />
&nbsp; &nbsp; //should stop <br />
<br />
producing.<br />
&nbsp; &nbsp; sleep(3);<br />
&nbsp; &nbsp; quitting=True; <br />
&nbsp; &nbsp; printf(&quot;Now the main program wants to quit...\n&quot;);<br />
<br />
<br />
&nbsp; &nbsp; for(int i = 0; i &lt; CONSUMERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_join(consumer_threads[i], NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not join thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; for(int i = 0; i &lt; PRODUCERS; ++i)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(pthread_join(producer_threads[i], NULL))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;Could not join thread %d\n&quot;, i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; printf(&quot;All threads are dead\n&quot;);<br />
<br />
&nbsp; &nbsp; sem_destroy(&amp;semaphore);<br />
&nbsp; &nbsp; pthread_mutex_destroy(&amp;mutex);<br />
<br />
&nbsp; &nbsp; printf(&quot;All over.. now everything should match\n&quot;);<br />
&nbsp; &nbsp; printf(&quot;stacksize (should be 0) = %i\n&quot;,stacksize);<br />
&nbsp; &nbsp; printf(&quot;production_total = %i\n&quot;,production_total);<br />
&nbsp; &nbsp; printf(&quot;consumption_total = %i (needs to match production)\n&quot;,consumption_total);<br />
<br />
&nbsp; &nbsp; printf(&quot;Production array broken down:\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,production[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
&nbsp; &nbsp; printf(&quot;Consumption array broken down (needs to match production array):\n&quot;);<br />
&nbsp; &nbsp; for(int i=0;i&lt;PRODUCTS;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  printf(&quot;%i &quot;,consumption[i]);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; printf(&quot;\n&quot;);<br />
<br />
&nbsp; &nbsp; return 0;<br />
}</pre></div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/cpp.gif" alt="File Type: cpp" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12485&amp;d=1257622925">project_1.cpp</a> (7.1 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>hakan5</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236854.html</guid>
		</item>
		<item>
			<title><![CDATA[[seraching for c++ coders]]]></title>
			<link>http://www.daniweb.com/forums/thread236848.html</link>
			<pubDate>Sat, 07 Nov 2009 19:03:13 GMT</pubDate>
			<description>Hello every one. I would like to ask any one who is able to code c++  if any one would like to work on a new code for a new or old game Final Fantasy XI. 
 
Projectxi.org is doing some good work, but could really use some help from you guys, and it would be a honor to have some of your help. We...</description>
			<content:encoded><![CDATA[<div>Hello every one. I would like to ask any one who is able to code c++  if any one would like to work on a new code for a new or old game Final Fantasy XI.<br />
<br />
Projectxi.org is doing some good work, but could really use some help from you guys, and it would be a honor to have some of your help. We have a massaive lagg issuse and our conectioion is only letting us allow 9 players to play on one server. So I thought It would be a good idea to ask you for help.<br />
But if your willing to just check out the code and maybe post some ideas at projectxi.org for help This would be very awsome.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>mancent</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236848.html</guid>
		</item>
		<item>
			<title>which c++ software is best?</title>
			<link>http://www.daniweb.com/forums/thread236847.html</link>
			<pubDate>Sat, 07 Nov 2009 19:02:16 GMT</pubDate>
			<description>which c++ compiler is easy n best? i want to download........... 
 
guide me......</description>
			<content:encoded><![CDATA[<div>which c++ compiler is easy n best? i want to download...........<br />
<br />
guide me......</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>IT seeker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236847.html</guid>
		</item>
		<item>
			<title>building sphinx4 helloworld in netbeans - errors</title>
			<link>http://www.daniweb.com/forums/thread236843.html</link>
			<pubDate>Sat, 07 Nov 2009 18:52:41 GMT</pubDate>
			<description><![CDATA[Hello :-)! 
 
There is a problem with building project in NetBeans. 
 
I've got two directories sphinx4-1.0beta3-src and sphinx4-1.0beta3-bin, which are part of speech recognition system CMU Sphinx, Sphinx4 is written in Java. In the directory S:\tutorial\sphinx4-1.0beta3-bin\bin I've got some .jar...]]></description>
			<content:encoded><![CDATA[<div>Hello :-)!<br />
<br />
There is a problem with building project in NetBeans.<br />
<br />
I've got two directories sphinx4-1.0beta3-src and sphinx4-1.0beta3-bin, which are part of speech recognition system CMU Sphinx, Sphinx4 is written in Java. In the directory S:\tutorial\sphinx4-1.0beta3-bin\bin I've got some .jar files, e.g. HelloDigits.jar. In S:\tutorial\sphinx4-1.0beta3-src there is no bin directory, however there are some directories here S:\tutorial\sphinx4-1.0beta3-src\src\apps\edu\cmu\sphinx\demo, e.g. S:\tutorial\sphinx4-1.0beta3-src\src\apps\edu\cmu\sphinx\demo\hellodigits contains five files: digits.gram, hellodigits.config.xml, HelloDigits.java, hellodigits.Manifest, README.html. The file readme is the same as here: <a rel="nofollow" class="t" href="http://cmusphinx.sourceforge.net/sphinx4/src/apps/edu/cmu/sphinx/demo/helloworld/README.html" target="_blank">http://cmusphinx.sourceforge.net/sph...ld/README.html</a> . I'm sure I've got jsapi.jar.<br />
<br />
In other words in one directory (sphinx4-1.0beta3-bin) I have got executable .jar files (or rather not executable, but to be interpreted by JVM). In other (sphinx4-1.0beta3-src) I have got source codes of those applications. There are some additional files, not only .java source code. The most important are two of them, i.e. .java and .xml.<br />
<br />
In order to run the HelloDigits.jar I do the following in Command Prompt &quot;S:\tutorial\sphinx4-1.0beta3-bin\java -mx256m -jar bin/HelloWorld.jar&quot;. It shows me proper thing, i.e. asks me to start speaking.<br />
<br />
OK, so I know how to run already existing application. But if I'd like to create my own, I need to follow this <a rel="nofollow" class="t" href="http://cmusphinx.sourceforge.net/sphinx4/#setupide" target="_blank">http://cmusphinx.sourceforge.net/sphinx4/#setupide</a> . First of all I create new project (File -&gt; New Project; I leave default values). I need to follow first step. In Projects -&gt; Source Packages I've got &quot;javaapplication -&gt; Main.java&quot;. I simply drag-and-drop those three folders from S:\tutorial\sphinx4-1.0beta3-src\src (those are apps, research, sphinx4) and after some seconds I've got several more things in Source Packages, e.g. &quot;apps.edu.cmu.sphinx.demo&quot;. In order to fulfill the second step, I click right mouse button on Libraries and choose &quot;Add JAR/Folder&quot;. I add from this directory S:\tutorial\sphinx4-1.0beta3-src\lib three files, i.e. js.jar, jsapi.jar and tags.jar. It was surprise for me that there was not tags.jar in S:\tutorial\sphinx4-1.0beta3-src\lib so I copied it from sphinx4-1.0beta3-src directory. Now I've got four things in Libraries, three new and one already existing (JDK 1.6 (Default)).<br />
<br />
In Main.java I've got default code of NetBeans which is definitely not what I want to have. Some tips how to create my own applications are here <a rel="nofollow" class="t" href="http://cmusphinx.sourceforge.net/sphinx4/doc/ProgrammersGuide.html#hellodigits" target="_blank">http://cmusphinx.sourceforge.net/sph...ml#hellodigits</a> . I replace default code completely with that one from example. I click &quot;Build main project&quot; in the menu. After some time it creates me C:\Documents and Settings\MainAccount\Moje dokumenty\NetBeansProjects\JavaApplication4 and there is unfortunately &quot;BUILD FAILED (total time: 8 seconds)&quot;. Those errors are included with this post.<br />
<br />
What should I do to build the project properly?<br />
<br />
Thanks very much for your help in advance :-)!<br />
Greetings :-)!</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12482&amp;d=1257619957">123b errors when building helloworld in netbeans.txt</a> (26.7 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>johnyjj2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236843.html</guid>
		</item>
		<item>
			<title>Compiler not working on my pc</title>
			<link>http://www.daniweb.com/forums/thread236831.html</link>
			<pubDate>Sat, 07 Nov 2009 17:56:35 GMT</pubDate>
			<description>i hav installed Turbo C++ 3.0 on my pc and whenever i dbl click on TC.exe 
the screen turns black and after 2-3 secs the screen becomes normal  
i mean the compiler doesnt start same happens with borland 5.5 C++ 
builder 
pls help me as i hav no s/w on which i can practice my programs n in 5 days i...</description>
			<content:encoded><![CDATA[<div>i hav installed Turbo C++ 3.0 on my pc and whenever i dbl click on TC.exe<br />
the screen turns black and after 2-3 secs the screen becomes normal <br />
i mean the compiler doesnt start same happens with borland 5.5 C++<br />
builder<br />
pls help me as i hav no s/w on which i can practice my programs n in 5 days i hav practical exam in college<br />
<br />
can anyone help<br />
is there ny fault with my pc or something else <br />
reply asap<br />
wat should i do now</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>nick1188</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236831.html</guid>
		</item>
		<item>
			<title>Why this code doesnt work?</title>
			<link>http://www.daniweb.com/forums/thread236828.html</link>
			<pubDate>Sat, 07 Nov 2009 17:19:45 GMT</pubDate>
			<description><![CDATA[Hello.. 
Ive written this code which dont work, its jobis simply recieving names from the user in a structure [a] and delete a name that chosen by user, the compiler give me error flag in the line noticed bellow:) 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hello..<br />
Ive written this code which dont work, its jobis simply recieving names from the user in a structure [a] and delete a name that chosen by user, the compiler give me error flag in the line noticed bellow:)<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream.h&gt;<br />
#include &lt;conio.h&gt;<br />
<br />
struct m{<br />
&nbsp; &nbsp; &nbsp;  char n[15];&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp;  };<br />
&nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
void main()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
{<br />
&nbsp;  m a[50];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; char name[15];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;  int i,size;<br />
&nbsp; &nbsp; cin&gt;&gt;size;&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp;  <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for(i=0;i&lt;size;i++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;entr elements&quot;;<br />
&nbsp; &nbsp; cin&gt;&gt;(a[i]).n;<br />
<br />
}<br />
cout&lt;&lt;&quot;enter elment&quot;;<br />
&nbsp; &nbsp; cin&gt;&gt;name;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; for (int j=0;j&lt;size;j++)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; if((a[j]).n==name)<br />
&nbsp; &nbsp; for(int c=j; c&lt;size;c++)<br />
&nbsp; &nbsp; ((a[c]).n)=((a[c+1]).n);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //this is The LINE<br />
}<br />
&nbsp; &nbsp; for(i=0;i&lt;size;i++)<br />
&nbsp; &nbsp; cout&lt;&lt;(a[i]).n&lt;&lt;endl;<br />
&nbsp; &nbsp; <br />
getch();<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>lucky_43</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236828.html</guid>
		</item>
		<item>
			<title>Grabbing a reference to or pointer to...</title>
			<link>http://www.daniweb.com/forums/thread236823.html</link>
			<pubDate>Sat, 07 Nov 2009 16:59:14 GMT</pubDate>
			<description><![CDATA[Hi guys, 
 
I was hoping someone could explain to me how I would go about grabbing a pointer/reference to my variable 'textName' contained within the Reports class, (some code omitted to try to simplify the scenario) 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>Hi guys,<br />
<br />
I was hoping someone could explain to me how I would go about grabbing a pointer/reference to my variable 'textName' contained within the Reports class, (some code omitted to try to simplify the scenario)<br />
<br />
 <pre style="margin:20px; line-height:13px">//Reports.h<br />
class Reports : public wxPanel <br />
{<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; void AddStudent(wxCommandEvent &amp; event);<br />
&nbsp; &nbsp; &nbsp; &nbsp; wxTextCtrl *textName; // declare variable<br />
};</pre> <pre style="margin:20px; line-height:13px">//Reports.cpp<br />
Reports::Reports(wxPanel * parent)<br />
&nbsp; &nbsp; &nbsp;  : wxPanel(parent, wxID_ANY, wxPoint(-1, -1), wxSize(500, 500))<br />
{<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; wxTextCtrl *textName = new wxTextCtrl(this, wxID_AddStudent, wxT(&quot;&quot;), wxPoint(65, 65));<br />
<br />
}<br />
<br />
void Reports::AddStudent(wxCommandEvent &amp; WXUNUSED(event))<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; // The following breaks the code, I want to grab textName<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName.SetValue(&quot;Test&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName.SetFocus();&nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* *************************<br />
&nbsp; &nbsp; &nbsp; &nbsp; If I re-create textName then access (as shown in the following <br />
&nbsp; &nbsp; &nbsp; &nbsp; commented code) then it works fine but I can't<br />
&nbsp; &nbsp; &nbsp; &nbsp; work out how to create a pointer/reference to the<br />
&nbsp; &nbsp; &nbsp; &nbsp; previous textName rather than having to re-create one!<br />
<br />
wxTextCtrl *textName = new wxTextCtrl(this,wxID_AddStudent, wxT(&quot;Another button...&quot;), wxPoint(65, 95));<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName-&gt;SetValue(&quot;Testing&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; textName-&gt;SetFocus(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; *******************************/<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>pac-man</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236823.html</guid>
		</item>
		<item>
			<title>Why does the following code works?</title>
			<link>http://www.daniweb.com/forums/thread236821.html</link>
			<pubDate>Sat, 07 Nov 2009 16:33:59 GMT</pubDate>
			<description><![CDATA[The following code works, it prints hello world. 
Also, depending on the second value, it either gives segmentation fault or doesn't gives segmentation fault. 
Can someone please explain me what is happening internally. 
  <div class="codeblock"> <div class="spaced"> <div style="float:right;...]]></description>
			<content:encoded><![CDATA[<div>The following code works, it prints hello world.<br />
Also, depending on the second value, it either gives segmentation fault or doesn't gives segmentation fault.<br />
Can someone please explain me what is happening internally.<br />
 <pre style="margin:20px; line-height:13px"> int main = ( cout &lt;&lt; &quot;Hello world!\n&quot;, 195 );</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>aagajaba</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236821.html</guid>
		</item>
		<item>
			<title>Creating an xy screen of tiny boxes</title>
			<link>http://www.daniweb.com/forums/thread236809.html</link>
			<pubDate>Sat, 07 Nov 2009 15:41:26 GMT</pubDate>
			<description>Hi, I need to produce an xy matrix on screen of tiny boxes, each equivalent to 2.5 x 2.5 mm.  I want to group them into sixes.  When the mouse pointer is moved across the tiny boxes in any six group I want the program to register when the mouse pointer enters the particular six block of tiny boxes...</description>
			<content:encoded><![CDATA[<div>Hi, I need to produce an xy matrix on screen of tiny boxes, each equivalent to 2.5 x 2.5 mm.  I want to group them into sixes.  When the mouse pointer is moved across the tiny boxes in any six group I want the program to register when the mouse pointer enters the particular six block of tiny boxes and when it leaves that block to output an ascii character relating to which tiny boxes where touched by the mouse pointer as it travels across the screen.<br />
Can anyone help with anything available that could be modified or perhaps how I can start with my little knowledge of VB?  Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>micromic</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236809.html</guid>
		</item>
		<item>
			<title>Compiling Errors</title>
			<link>http://www.daniweb.com/forums/thread236800.html</link>
			<pubDate>Sat, 07 Nov 2009 15:14:20 GMT</pubDate>
			<description>im new with C++ . i was in java but now im learning C++ and i am not very good at it . i am making a program about spam and ham emails . i have all the files in the same directory . i created Ergasia1.cpp , Ergasia1.h , Feature.cpp , Feature.h 
but when i compile Ergasia1.cpp i got errors like : 
...</description>
			<content:encoded><![CDATA[<div>im new with C++ . i was in java but now im learning C++ and i am not very good at it . i am making a program about spam and ham emails . i have all the files in the same directory . i created Ergasia1.cpp , Ergasia1.h , Feature.cpp , Feature.h<br />
but when i compile Ergasia1.cpp i got errors like :<br />
<br />
1. &quot; In file included from Ergasia1.cpp &quot;<br />
2. &quot; Ergasia1.h [Warning] extra tokens at end of #endif directive &quot;<br />
3. &quot;Feature.h [Warning] extra tokens at end of #endif directive &quot; (after this error there are several errors like this &quot;  [Linker error] undefined reference to `Feature::getDescription()' &quot;<br />
4. &quot; Feature.h ld returned 1 exit status &quot;<br />
<br />
and when i compile Feature.cpp i got errors like :<br />
<br />
1. &quot; In file included from Feature.cpp &quot;<br />
2. &quot;   [Linker error] undefined reference to `WinMain@16' &quot;<br />
3. &quot; Feature.h ld returned 1 exit status &quot;<br />
<br />
Ergasia1.cpp<br />
 <pre style="margin:20px; line-height:13px"> <br />
#include &quot;Ergasia1.h&quot;<br />
#include &quot;Feature.h&quot;<br />
<br />
using namespace std;<br />
<br />
Ergasia1::Ergasia1()<br />
{<br />
#ifdef DEVEL<br />
&nbsp; &nbsp; &nbsp; &nbsp; tst= &quot;../../&quot;;<br />
#else <br />
&nbsp; &nbsp; &nbsp; &nbsp; tst= &quot;./&quot;;<br />
#endif<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool AllOK= FillvsKeys();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (AllOK) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetFiles(LING);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GetFiles(SPAM);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Incorrect Installation!&quot; &lt;&lt; endl;<br />
}<br />
<br />
const void Ergasia1::AnalyzeFile(const string fn) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; string fname= fn.substr(tst.length());<br />
&nbsp; &nbsp; &nbsp; &nbsp; size_t pos= fname.find_first_of(&quot;/&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; string kind= &quot;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (pos != string::npos)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; kind= fname.substr(0, pos);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int KeywordsFound= 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream ifs(fn.c_str());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; if (ifs.is_open()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; n++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vector&lt;Feature&gt; vf; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (! ifs.eof()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(ifs, line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (unsigned int i= 0; i &lt; vsKeys.size(); i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string key= vsKeys[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (line.find(key) != string::npos) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bool found= false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (unsigned int j= 0; j &lt; vf.size(); j++) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (vf[j].getDescription().compare(key) == 0) {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int x= vf[j].getFrequency();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vf[j].setFrequency(++x);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; found= true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (! found) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Feature *f= new Feature(i, 1, key);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vf.push_back(*f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KeywordsFound++; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; ifs.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ostringstream osst;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osst &lt;&lt; &quot;&lt;message file=\&quot;&quot; &lt;&lt; fname &lt;&lt;&quot;\&quot; category=\&quot;&quot; &lt;&lt; kind &lt;&lt; &quot;\&quot; features=\&quot;&quot; &lt;&lt; KeywordsFound &lt;&lt; &quot;\&quot;&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsStream.push_back(osst.str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osst.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (unsigned int i= 0; i &lt; vf.size(); i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ostringstream ossb;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ossb &lt;&lt; &quot;&lt;feature id=\&quot;&quot; &lt;&lt; vf[i].getId() &lt;&lt; &quot;\&quot; freq=\&quot;&quot; &lt;&lt; vf[i].getFrequency() &lt;&lt; &quot;\&quot;&gt; &quot; &lt;&lt; vf[i].getDescription() &lt;&lt; &quot; &lt;/feature&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsStream.push_back(ossb.str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ossb.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ostringstream osse;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osse &lt;&lt; &quot;&lt;/message&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; osse.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
const void Ergasia1::GetFiles(const string Kind) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; string s= tst + Kind + FILENAME;//&quot;_filenames.txt&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream ifs(s.c_str());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; if (ifs.is_open()) {<br />
&nbsp; &nbsp; while (! ifs.eof()) {<br />
&nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(ifs, line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AnalyzeFile(tst + line);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; ifs.close();<br />
&nbsp; }<br />
}<br />
<br />
const bool Ergasia1::FillvsKeys() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool result= true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string s= tst + KEYWORDS;<br />
&nbsp; &nbsp; &nbsp; &nbsp; n= 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream ifs(s.c_str());&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; if (ifs.is_open()) {<br />
&nbsp; &nbsp; while (! ifs.eof()) {<br />
&nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; getline(ifs, line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vsKeys.push_back(line);<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result= false;<br />
&nbsp; ifs.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; return result;<br />
}<br />
<br />
const void Ergasia1::ShowData() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;&lt;messagecollection messages=\&quot;&quot; &lt;&lt; n &lt;&lt; &quot;\&quot;&gt;&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(unsigned int i= 0; i &lt; vsStream.size(); i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; vsStream[i] &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;&lt;/messagecollection&gt;&quot; &lt;&lt; endl;<br />
}<br />
<br />
int main(int argc, char **argv) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Ergasia1 e;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}</pre><br />
<br />
<br />
Ergasia.h<br />
 <pre style="margin:20px; line-height:13px">#include &lt;fstream&gt;<br />
#include &lt;string&gt;<br />
#include &lt;vector&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;sstream&gt;<br />
<br />
#ifdef _DEBUG<br />
#define DEVEL<br />
#endif<br />
<br />
using namespace std;<br />
<br />
#ifndef FILENAME<br />
#define FILENAME &quot;_filenames.txt&quot;;<br />
#endif<br />
<br />
#ifndef KEYWORDS<br />
#define KEYWORDS &quot;keywords.txt&quot;<br />
#endif<br />
<br />
#ifndef LING<br />
#define LING &quot;ling&quot;<br />
#endif<br />
<br />
#ifndef SPAM<br />
#define SPAM &quot;spam&quot;<br />
#endif<br />
<br />
#ifndef ERGASIA1_H<br />
#define ERGASIA1_H<br />
<br />
class Ergasia1<br />
{<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; int n;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; string tst;<br />
&nbsp; &nbsp; &nbsp; &nbsp; //static const string FileName;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector&lt;string&gt; vsKeys;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector&lt;string&gt; vsStream;<br />
&nbsp; &nbsp; &nbsp; &nbsp; const void AnalyzeFile(const string fn);<br />
&nbsp; &nbsp; &nbsp; &nbsp; const void GetFiles(const string Kind);<br />
&nbsp; &nbsp; &nbsp; &nbsp; const bool FillvsKeys();<br />
&nbsp; &nbsp; &nbsp; &nbsp; const void ShowData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; Ergasia1();<br />
}<br />
#endif <br />
//ERGASIA1_H<br />
<br />
int main(int argc, char **argv);</pre><br />
<br />
Feature.cpp<br />
 <pre style="margin:20px; line-height:13px">#include &quot;Feature.h&quot;<br />
<br />
void Feature::setId(int i) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Id= i;<br />
}<br />
<br />
void Feature::setFrequency(int f) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Frequency= f;<br />
}<br />
<br />
void Feature::setDescription(const string d) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; Description= d;<br />
}<br />
<br />
int Feature::getId() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return Id;<br />
}<br />
<br />
int Feature::getFrequency() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return Frequency;<br />
}<br />
<br />
string Feature::getDescription() {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return Description;<br />
}<br />
<br />
Feature::Feature(int i, int f, const string d) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; setId(i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setFrequency(f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; setDescription(d);<br />
}</pre><br />
<br />
<br />
<br />
Feature.h<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
#ifndef FEATURE_H<br />
#define FEATURE_H<br />
<br />
class Feature {<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Id;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int Frequency;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string Description;<br />
public: <br />
&nbsp; &nbsp; &nbsp; &nbsp; void setId(int i);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setFrequency(int f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setDescription(const string d);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int getId();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int getFrequency();<br />
&nbsp; &nbsp; &nbsp; &nbsp; string getDescription();<br />
&nbsp; &nbsp; &nbsp; &nbsp; Feature(int i, int f, const string d);<br />
}<br />
#endif <br />
//FEATURE_H</pre><br />
<br />
thats the files i created . any help will be appreciate . thanks in advance my friends .</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>konefsta</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236800.html</guid>
		</item>
		<item>
			<title>std::string capacity(). Different in different OSs?!?!</title>
			<link>http://www.daniweb.com/forums/thread236795.html</link>
			<pubDate>Sat, 07 Nov 2009 14:39:02 GMT</pubDate>
			<description><![CDATA[Hi, I have a question. 
 
Using the following code: 
 
 
#include <iostream> 
int main() 
{ 
	std::string s1; 
	std::cout << s1.capacity() << std::endl;]]></description>
			<content:encoded><![CDATA[<div>Hi, I have a question.<br />
<br />
Using the following code:<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
int main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::string s1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::cout &lt;&lt; s1.capacity() &lt;&lt; std::endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; system (&quot;PAUSE&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}</pre><br />
In Ubuntu/KDevelop the output is 0.<br />
<br />
In Windows/V.Studio the output is 15.<br />
<br />
Can anyone suggest why it happens?<br />
<br />
I'm somewhat stumped by it's occurrence.<br />
<br />
Thanks very much, much appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Carrots</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236795.html</guid>
		</item>
		<item>
			<title>Using Graphics Pointer to Draw objects(TREE) in a Class (Windows Forms Applications)</title>
			<link>http://www.daniweb.com/forums/thread236793.html</link>
			<pubDate>Sat, 07 Nov 2009 14:20:33 GMT</pubDate>
			<description>hi,i am making trees and i want to draw the structure of the tree in windows forms applications.since the class tree has the access to the trees root pointer.so only a member function of the class can draw the nodes of that tree. 
 
but i cannot use the graphics pointer int the tree class,it gives...</description>
			<content:encoded><![CDATA[<div>hi,i am making trees and i want to draw the structure of the tree in windows forms applications.since the class tree has the access to the trees root pointer.so only a member function of the class can draw the nodes of that tree.<br />
<br />
but i cannot use the graphics pointer int the tree class,it gives some error.<br />
<br />
i tried to use friend function but it wasnt working in form1.h .<br />
<br />
Any Solutions??<br />
<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>arshad115</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236793.html</guid>
		</item>
		<item>
			<title>Compiling error (novice problem)</title>
			<link>http://www.daniweb.com/forums/thread236789.html</link>
			<pubDate>Sat, 07 Nov 2009 13:30:31 GMT</pubDate>
			<description>I was having problems with this program or better with the int main() function. The program is supposed to ask the user for his name and password. After that the user will be able to access different infos based on his security clearing. 
The comments in the code are English tho the program itself...</description>
			<content:encoded><![CDATA[<div>I was having problems with this program or better with the int main() function. The program is supposed to ask the user for his name and password. After that the user will be able to access different infos based on his security clearing.<br />
The comments in the code are English tho the program itself is in German (long story why its in German ^^)<br />
I shortened the code so it will only work properly for the user &quot;kornelia&quot; and &quot;eduard&quot; (both with high security clearing)<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;cstdio&gt;<br />
#include &lt;cmath&gt;<br />
#include &lt;iostream&gt; <br />
#include &lt;cstdlib&gt;<br />
&nbsp;<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
cout &lt;&lt; &quot;\t\tNetwork&quot;;<br />
<br />
//declaring security<br />
int info;<br />
int security = 0;<br />
<br />
//getting the Username<br />
string szUsername;<br />
cout &lt;&lt;&quot;\nUsername: &quot;;<br />
cin &gt;&gt; szUsername;<br />
<br />
//getting the password<br />
string szPassword;<br />
cout &lt;&lt;&quot;\npassword: &quot; &lt;&lt; endl;<br />
cin &gt;&gt; szPassword;<br />
<br />
//action for successful loggin of the user &quot;kornelia&quot;<br />
if (szUsername == &quot;kornelia&quot; &amp;&amp; szPassword == &quot;lelewel8&quot;)<br />
{<br />
cout &lt;&lt; &quot;\nHallo Kornelia, dein login war erfolgreich&quot;;<br />
security = 5;<br />
}<br />
// action for successful loggin of the user &quot;eduard&quot;<br />
if (szUsername == &quot;eduard&quot; &amp;&amp; szPassword == &quot;afkem2009&quot;)<br />
{<br />
cout &lt;&lt; &quot;\nHallo Eduard, du hast dich erfolgreich eingeloggt&quot;;<br />
security = 5;<br />
}<br />
//action for successful loggin of the user &quot;gast&quot;<br />
if (szUsername == &quot;gast&quot; || szPassword == &quot;gast&quot;)<br />
{<br />
cout &lt;&lt; &quot;\nHerzlich willkommen Gast&quot;;<br />
security = 1;<br />
}<br />
//action for wrong name or password<br />
if (!security)<br />
&nbsp;  cout &lt;&lt; &quot;Ihr loggin ist fehlgeschlagen\n&quot; &lt;&lt; endl;<br />
<br />
//action for security clearing = 5<br />
if (security == 5)<br />
{<br />
// welcome and basic menu for selecting infos<br />
cout &lt;&lt; &quot;Sie haben Sicherheitsstufe 5 (777 Rechte)&quot; &lt;&lt; endl;<br />
cout &lt;&lt; &quot;Welche Informationen wollen sie erhalten?\n1: Computerpassword Kornelia&quot;;<br />
cout &lt;&lt; &quot;\n2: Computerpassword Eduard\n3: Routerpassword&quot;;<br />
cin &lt;&lt; info;<br />
// cout the infos<br />
if (info == 1)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Der Computer besitzt kein Password&quot;;<br />
}<br />
if (info == 2)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Das Computerpassword von Eduard lautet: afkem2009&quot;;<br />
}<br />
if (info == 3)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Benutzername: admin\nPassword: lelewel8&quot;;<br />
}<br />
}<br />
// end<br />
system(&quot;PAUSE&quot;);<br />
return 0;<br />
}</pre><br />
thank you in advance and please don't just give me a solved program back because I really want to understand what I've done wrong :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>lexsoOr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236789.html</guid>
		</item>
		<item>
			<title>Socket programming on windows</title>
			<link>http://www.daniweb.com/forums/thread236785.html</link>
			<pubDate>Sat, 07 Nov 2009 13:14:07 GMT</pubDate>
			<description>Hey all! I am interested in learning to use sockets. make client and server program. Where should I begin? 
 
Thanks!</description>
			<content:encoded><![CDATA[<div>Hey all! I am interested in learning to use sockets. make client and server program. Where should I begin?<br />
<br />
Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Silvershaft</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236785.html</guid>
		</item>
		<item>
			<title>I/O program with major issues</title>
			<link>http://www.daniweb.com/forums/thread236770.html</link>
			<pubDate>Sat, 07 Nov 2009 12:10:00 GMT</pubDate>
			<description><![CDATA[Figure I might as well go ahead and clear up that this is obviously a school assignment. I have completed a somewhat decent amount of code (not saying I have a lot of faith in it's correctness tho) and need assistance to figure the rest out. I'm at a complete loss due to teacher and book not really...]]></description>
			<content:encoded><![CDATA[<div>Figure I might as well go ahead and clear up that this is obviously a school assignment. I have completed a somewhat decent amount of code (not saying I have a lot of faith in it's correctness tho) and need assistance to figure the rest out. I'm at a complete loss due to teacher and book not really covering material in a way to prepare for the assignment. I have looked over the tutorials for I/O on this site as well as others and if I need to change things, I'm wide open for assistance. I did attempt to figure out as much as I could, but I'm stuck. Thanks in advance for anyone who takes time to assist me. I greatly appreciate it. <br />
<br />
To clear things up from the start, here are the instructions:<br />
<br />
The program is to take a text file, students.txt, containing information about the currently-enrolled students in a school. Each<br />
line represents a record for a different student and contains the student's identification number (eight digits), credit hours<br />
completed, and grade point average. A sample line follows:<br />
<br />
10082352 66 3.04<br />
<br />
Program is supposed to have the identification number and grade point average for each student in the file copied to one of four<br />
different text files based on the number of credit hours completed:<br />
<br />
Less than 32 freshmen.txt<br />
32 to 63 sophomores.txt<br />
64 to 95 juniors.txt<br />
96 or more seniors.txt<br />
<br />
Next is to write the identification number and grade point average of each student on a single line (one line per student) in the<br />
appropriate file. For example, since the student mentioned above has completed 66 credit hours, the following would be<br />
added to the file juniors.txt:<br />
<br />
10082352 3.04<br />
<br />
<br />
The number of students in the original file is unknown, so the program will need to read these records in until you reach the end of<br />
the file. <br />
<br />
Also, no student should have a negative number of credit hours, and the maximum number of credit<br />
hours that a student can accumulate is 250. If the program encounters a student record with an erroneous number of<br />
credit hours, write the entire record for that student (identification number, credit hours, and grade point average) to the<br />
file hoursError.txt rather than any of the four aforementioned files. The lowest grade point average a student may have is 0.0, and the highest grade point average a<br />
student may have is 4.0. If the program encounters a student record with an erroneous grade point average, write the<br />
entire record for that student to the file averageError.txt rather than any of the four aforementioned files.As was previously stated, the student's identification number should be eight digits. If the program<br />
encounters a student record with an identification number of fewer or greater than eight digits, write the entire record for<br />
that student to the file identError.txt rather than any of the four aforementioned files.Assume that an identification number error has highest precedence, then the<br />
number of credit hours completed, then the grade point average. Don't write a student record to multiple error files: only<br />
the one that has the highest precedence should receive the record.<br />
<br />
I'm going in the direction that I believe it needs to have the input file made into a dynamic array, but not sure how to do that. <br />
<br />
Here is the code I have with compiler errors formatted within brackets after comment code. e.g. //[compiler error]<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;fstream&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;iomanip&gt;<br />
#include &lt;cstdlib&gt;<br />
using namespace std;<br />
<br />
/** [ I get the &quot;unknown size&quot; error on all of these b/c I don't know how to assign them ] */<br />
<br />
int studentID[];<br />
int creditHours[];<br />
double gpa[];<br />
<br />
<br />
int main()<br />
{<br />
<br />
int studentID[]; <br />
int creditHours[]; <br />
int gpa[];<br />
ifstream students; <br />
ofstream freshman, sophomores, juniors, seniors; <br />
<br />
<br />
ifstream in_stream;<br />
in_stream.open(&quot;students.txt&quot;);<br />
<br />
if (in_stream.fail())<br />
{<br />
cout&lt;&lt; &quot;Input file opening failed.\n&quot;;<br />
exit(1);<br />
}<br />
<br />
ofstream out_stream;<br />
out_stream.open(&quot;freshmen.txt&quot;);<br />
out_stream.open(&quot;sophomores.txt&quot;);<br />
out_stream.open(&quot;juniors.txt&quot;);<br />
out_stream.open(&quot;seniors.txt&quot;);<br />
out_stream.open(&quot;hoursError.txt&quot;);<br />
out_stream.open(&quot;averageError.txt&quot;);<br />
out_stream.open(&quot;identError.txt&quot;);<br />
<br />
if (out_stream.fail())<br />
{<br />
cout&lt;&lt; &quot;Output file opening failed.\n&quot;;<br />
exit(1);<br />
}<br />
<br />
out_stream.setf(ios::fixed);<br />
out_stream.setf(ios::showpoint);<br />
out_stream.precision(2);<br />
<br />
while (!students.eof())<br />
{<br />
<br />
void getInput(ifstream students, int &amp;studentID, int &amp;creditHours, int &amp;gpa);<br />
<br />
}<br />
<br />
<br />
/** [ error C2446: '&lt;' : no conversion from 'int *' to 'int' There is no context in which this conversion is possible ] &amp; [ error C2040: '&lt;' : 'int' differs in levels of indirection from 'int []' ] */<br />
<br />
for (int i=0; i &lt; studentID; i++)<br />
out_stream &lt;&lt; studentID[i] &lt;&lt; creditHours[i] &lt;&lt; gpa[i] &lt;&lt; endl;<br />
<br />
<br />
in_stream.close();<br />
out_stream.close();<br />
}<br />
<br />
<br />
<br />
/** [ error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ]*/<br />
<br />
getInput(ifstream students, int &amp;studentID, int &amp;creditHours, int &amp;gpa); <br />
<br />
// [ error C2447: '{' : missing function header (old-style formal list?) ]<br />
{ <br />
&nbsp; &nbsp; int i = 0; <br />
&nbsp; &nbsp; &nbsp; &nbsp; while(!students.eof()) <br />
&nbsp; &nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp;  students &gt;&gt; &amp;studentID[i] &gt;&gt; &amp;creditHours[i] &gt;&gt; &amp;gpa[i]; <br />
&nbsp; &nbsp; &nbsp;  cout &lt;&lt; studentID[i] &lt;&lt; creditHours[i] &lt;&lt; gpa[i] &lt;&lt; endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  i++; <br />
&nbsp; &nbsp; &nbsp; &nbsp; } <br />
return;<br />
<br />
}</pre><br />
<br />
Thanks again for anyone who has patience to assist me. It's greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Ryujin89</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236770.html</guid>
		</item>
		<item>
			<title>Questions on using the STL list sort method</title>
			<link>http://www.daniweb.com/forums/thread236726.html</link>
			<pubDate>Sat, 07 Nov 2009 07:49:16 GMT</pubDate>
			<description><![CDATA[I am very new to using the STL list library. From what I have been reading here and other places on the web is that I have to create a compare function to use within the sort member function of list. The reason being that the list node's contain structures. I have to sort the list by a few...]]></description>
			<content:encoded><![CDATA[<div>I am very new to using the STL list library. From what I have been reading here and other places on the web is that I have to create a compare function to use within the sort member function of list. The reason being that the list node's contain structures. I have to sort the list by a few different variables. Below is the class that controls my list. I am getting two errors.<br />
<br />
Error 1) error C3867: 'Standings::compareForSort': function call missing argument list; use '&amp;Standings::compareForSort' to create a pointer to member<br />
<br />
Error 2) error C2660: 'std::list&lt;_Ty&gt;::sort' : function does not take 1 arguments<br />
<br />
Any help here would be appreciated. <br />
<br />
 <pre style="margin:20px; line-height:13px">#ifndef STANDINGS_H<br />
#define STANDINGS_H<br />
<br />
#include &lt;iostream&gt;<br />
#include &lt;list&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;iomanip&gt;<br />
<br />
using namespace std;<br />
<br />
#define NAMELENGTH 20<br />
<br />
struct Records<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int totalWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int totalLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double winPercentage;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double gamesBehind;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int streakWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int streakLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int streakLength;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int homeWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int homeLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int awayWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int awayLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int interWin;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int interLose;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int division;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char teamName[NAMELENGTH];<br />
&nbsp; &nbsp; &nbsp; &nbsp; char streakType;<br />
<br />
};<br />
<br />
<br />
class Standings<br />
{<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt; recordsList;<br />
&nbsp; &nbsp; &nbsp; &nbsp; friend class Team;<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; Standings();<br />
&nbsp; &nbsp; &nbsp; &nbsp; ~Standings(){};<br />
&nbsp; &nbsp; &nbsp; &nbsp; void loadList();<br />
&nbsp; &nbsp; &nbsp; &nbsp; void saveList();<br />
&nbsp; &nbsp; &nbsp; &nbsp; void printStandings();<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool compareForSort (Records&amp;, Records&amp;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
};<br />
<br />
#endif<br />
<br />
#include &quot;standings.h&quot;<br />
<br />
Standings::Standings()<br />
{<br />
<br />
}&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
void Standings::loadList(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Create a variable of ifstream type names loadFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream loadFile;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Open standings txt file<br />
&nbsp; &nbsp; &nbsp; &nbsp; loadFile.open(&quot;standings.txt&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Temporary object of struct type Record<br />
&nbsp; &nbsp; &nbsp; &nbsp; Records r;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Loop to take from file put into class <br />
&nbsp; &nbsp; &nbsp; &nbsp; //and than put class into list<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(!loadFile.eof()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; loadFile &gt;&gt; r.teamName<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.totalWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.totalLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.winPercentage<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.gamesBehind<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakType<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.streakLength<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.homeWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.homeLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.awayWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.awayLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.interWin<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.interLose<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;&gt; r.division;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Checks to make sure its not the end of file.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //If its not the end of the file it inserts <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //the node at the end of the list<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(!loadFile.eof())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; recordsList.push_back(r);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  //closing the text file<br />
&nbsp; &nbsp; &nbsp; &nbsp; loadFile.close(); <br />
}<br />
<br />
void Standings::saveList()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Sorts the List before saving to txt<br />
&nbsp; &nbsp; &nbsp; &nbsp; recordsList.sort(compareForSort);<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Create a variable of ofstream type names saveFile<br />
&nbsp; &nbsp; &nbsp; &nbsp; ofstream saveFile;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Open standings txt file<br />
&nbsp; &nbsp; &nbsp; &nbsp; saveFile.open(&quot;standings.txt&quot;);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Create an iterator to keep place of the nodes saved<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt;::iterator i;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Loop through each node and save each member to that node<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( i=recordsList.begin(); i != recordsList.end(); ++i ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; saveFile &lt;&lt; right &lt;&lt; setw(13) &lt;&lt; i-&gt;teamName &lt;&lt; setw(4) &lt;&lt; i-&gt;totalWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(4) &lt;&lt; i-&gt;totalLose &lt;&lt; setw(7) &lt;&lt; setprecision(3) &lt;&lt; i-&gt;winPercentage <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(6) &lt;&lt; i-&gt;gamesBehind &lt;&lt; setw(2) &lt;&lt; i-&gt;streakWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLose&nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;streakType <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLength&nbsp; &lt;&lt; setw(3)&lt;&lt; i-&gt;homeWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;homeLose&nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;awayWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;awayLose&nbsp; &lt;&lt; setw(3)&lt;&lt; i-&gt;interWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(3) &lt;&lt; i-&gt;interLose&nbsp; &lt;&lt; setw(2) &lt;&lt; i-&gt;division <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
//Flush and Close txt file<br />
&nbsp; &nbsp; &nbsp; &nbsp; saveFile.flush();<br />
&nbsp; &nbsp; &nbsp; &nbsp; saveFile.close();<br />
<br />
}<br />
<br />
void Standings::printStandings()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt;::iterator i;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //Looping through each node and printing each variable of each node<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( i=recordsList.begin(); i != recordsList.end(); ++i ) <br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&nbsp; &lt;&lt; right &lt;&lt; setw(13) &lt;&lt; i-&gt;teamName &lt;&lt; setw(4) &lt;&lt; i-&gt;totalWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; setw(4) &lt;&lt; i-&gt;totalLose &lt;&lt; right &lt;&lt; setw(7) &lt;&lt; i-&gt;winPercentage <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(6) &lt;&lt; i-&gt;gamesBehind &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLose &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakType <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;streakLength &lt;&lt;right &lt;&lt; setw(3)&lt;&lt; i-&gt;homeWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;homeLose &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;awayWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;awayLose &lt;&lt; right &lt;&lt; setw(3)&lt;&lt; i-&gt;interWin <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; right &lt;&lt; setw(3) &lt;&lt; i-&gt;interLose &lt;&lt; right &lt;&lt; setw(2) &lt;&lt; i-&gt;division <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
<br />
bool Standings::compareForSort(Records&amp; node1, Records&amp; node2)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; list&lt;Records&gt;::iterator i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( i=recordsList.begin(); i != recordsList.end(); ++i ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if((node1.totalWin &gt; node2.totalWin) &amp;&amp; (node1.winPercentage &gt; node2.winPercentage) &amp;&amp; (node1.division &lt; node2.division))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Afupi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236726.html</guid>
		</item>
		<item>
			<title>Visual C++ form question</title>
			<link>http://www.daniweb.com/forums/thread236721.html</link>
			<pubDate>Sat, 07 Nov 2009 07:05:32 GMT</pubDate>
			<description>Hi, 
 
I am creating a Visual C++ application with a bunch of forms. I would like one form to stay open the entire time (just a screen to show app is running), then I need one form with two radio buttons, an OK button and a Cancel. If the OK button is clicked I want to close the form and continue...</description>
			<content:encoded><![CDATA[<div>Hi,<br />
<br />
I am creating a Visual C++ application with a bunch of forms. I would like one form to stay open the entire time (just a screen to show app is running), then I need one form with two radio buttons, an OK button and a Cancel. If the OK button is clicked I want to close the form and continue with the code in main, however, I can't seem to get this working.<br />
<br />
<br />
Any advice would be GREATLY appreciated.<br />
Thanks in advance.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Laryssaparker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236721.html</guid>
		</item>
		<item>
			<title>Array of structures not returning elements</title>
			<link>http://www.daniweb.com/forums/thread236708.html</link>
			<pubDate>Sat, 07 Nov 2009 05:22:07 GMT</pubDate>
			<description><![CDATA[Hi, 
The following code I've been working on (as hobbyist) compiles okay, buy at runtime it fails to output the dates that it is supposed to extract from a csv file. I've been staring at this forever and no progress. 
 
I am thinking that the problem occurs before the date verification function,...]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
The following code I've been working on (as hobbyist) compiles okay, buy at runtime it fails to output the dates that it is supposed to extract from a csv file. I've been staring at this forever and no progress.<br />
<br />
I am thinking that the problem occurs before the date verification function, because  when the program gets to cout &lt;&lt; &quot;This is the first date in the database&quot; and cout &lt;&lt; dataArray[0].date &lt;&lt; endl, it does not output the date. This means that the first element in the array is empty, which means that the array did not populate for some reason.<br />
<br />
Would appreciate any suggestions to identify the problem.<br />
<br />
Thanks<br />
TR<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">// Dataprep.cpp : Defines the entry point for the console application<br />
<br />
#include &quot;stdafx.h&quot;<br />
#include &lt;vector&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;string&gt; <br />
#include &lt;sstream&gt;<br />
#include &lt;math.h&gt;<br />
#include &lt;cstring&gt;<br />
using namespace std;<br />
int NumLines;<br />
void Error (int);<br />
int Open_Price_Data_File (char* filename);<br />
struct Bar* Define_Array (const char*);<br />
void Parse_Output_To_File (struct Bar* dataArray, const char*);<br />
void Date_Verification ();<br />
void ExitScreen ();<br />
<br />
<br />
<br />
//Structure Declaration and Array Initialization <br />
&nbsp; &nbsp; &nbsp;  struct Bar<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string date;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // date<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double open;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // opening price<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double high;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // high price<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double low;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // low price <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  double close;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // closing price<br />
<br />
&nbsp; &nbsp; &nbsp;  };<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  struct Bar *bararray;<br />
<br />
//Error catching function<br />
void Error(int errorcode) <br />
{<br />
&nbsp;if(errorcode == 1) {<br />
&nbsp; &nbsp;  cout &lt;&lt; &quot;Error in opening file...&quot;;<br />
&nbsp;}<br />
&nbsp;else cout &lt;&lt; &quot;OK&quot;;<br />
}<br />
<br />
<br />
//Function to open price data file<br />
&nbsp;int Open_Price_Data_File (char* filename)<br />
&nbsp;{<br />
&nbsp;  cout &lt;&lt; &quot;Enter filename in the following&nbsp; format c: backslash filename.csv: &quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cin &gt;&gt; filename;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ifstream infile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Reading from the price data file&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  infile.open(filename); <br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!infile.is_open()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Error (1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else return 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; infile.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return 1;<br />
&nbsp;}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
// Function to count number of lines in file &amp; define the array of structures accordingly<br />
struct Bar* Define_Array (const char* filename)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream infile;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; infile.open(filename); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(!infile.is_open())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Error (1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while(getline(infile, line))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  NumLines++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;This is the total number of lines in the source file: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; NumLines &lt;&lt; endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Bar *bararray = NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  bararray = new Bar[NumLines];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  infile.close();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return bararray;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
<br />
// String Parsing to Skip Commas<br />
&nbsp;void Parse_Output_To_File (struct Bar *dataArray, char* filename)<br />
&nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; ofstream outfile;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outfile.open (&quot;c:\\Outputfile.txt&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!outfile.is_open())<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Error in opening file for writing!&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else return;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ifstream redo;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  redo.open(filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int i = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (!redo.fail())&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int j = 0;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  string data, token;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  getline(redo, data);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  istringstream isstream (data);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  while (getline(isstream,token,',')) <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  outfile &lt;&lt; token &lt;&lt; &quot; &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].date = token;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].open = atof( token.c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 2) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].high = atof( token.c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(j == 3) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dataArray[i].low = atof( token.c_str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(j == 4) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataArray[i].close = atof(token.c_str ());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  continue;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  i++&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outfile &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; redo.close()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; outfile.close(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;}<br />
<br />
// Date Verification Function<br />
<br />
void Date_Verification (struct Bar *dataArray)<br />
{<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;This is the first date in the database: &quot;;<br />
&nbsp; &nbsp; cout &lt;&lt; dataArray[0].date &lt;&lt; endl;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;This is the last date in the database:&nbsp; &quot;;<br />
&nbsp; &nbsp; cout &lt;&lt; dataArray[NumLines - 1].date &lt;&lt; endl;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter the start date for the analysis in the mm/dd/yyyy format: &quot;;<br />
&nbsp; &nbsp; string startdate;<br />
&nbsp; &nbsp; cin &gt;&gt; startdate;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;The startdate you entered is: &quot; &lt;&lt; startdate &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; int i;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  for (i = 0; i &lt;= NumLines -1;)<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!strcmp(startdate.c_str(), dataArray[i].date.c_str()) == 0)&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i == NumLines -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Incorrect start date &quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Start date exists in the database&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
cout &lt;&lt; &quot;Enter the end date for the analysis in the mm/dd/yyyy format: &quot;;<br />
&nbsp; &nbsp; &nbsp;  string enddate;<br />
&nbsp; &nbsp; &nbsp;  cin &gt;&gt; enddate;<br />
&nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;The enddate you entered is: &quot; &lt;&lt; enddate &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp;  for (i = 0; i &lt;= NumLines -1;)<br />
&nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!strcmp(enddate.c_str(), dataArray[i].date.c_str()) == 0)&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (i == NumLines -1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; out &lt;&lt; &quot;Incorrect end date&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;End date exists in the database&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;}<br />
<br />
}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
<br />
// User Prompt to Retain Command Window <br />
void ExitScreen ()<br />
&nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Please press Q or q to quit: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if (ch=='Q' &amp;&amp; ch=='q') <br />
&nbsp; &nbsp; &nbsp; &nbsp; { <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Exiting...&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;Please press Q or q to quit: &quot;;<br />
&nbsp;}<br />
<br />
<br />
//Main Program<br />
int main ()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char filename [80];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Open_Price_Data_File (filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  struct Bar* Array;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Array = Define_Array (filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Parse_Output_To_File (Array, filename);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Date_Verification (Array);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ExitScreen ();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>toneranger</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236708.html</guid>
		</item>
		<item>
			<title>Dynamic Array and tacking a linked list to array?</title>
			<link>http://www.daniweb.com/forums/thread236679.html</link>
			<pubDate>Sat, 07 Nov 2009 01:40:54 GMT</pubDate>
			<description><![CDATA[Ok, I am trying to figure out how to purse this current project which deals with dynamic allocation and linked list 
 
Here is the information I am given the following two structs  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Ok, I am trying to figure out how to purse this current project which deals with dynamic allocation and linked list<br />
<br />
Here is the information I am given the following two structs <br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
struct employee<br />
{<br />
&nbsp; int ssn;<br />
&nbsp; string name;<br />
&nbsp; float hours;<br />
&nbsp; assignment * list;<br />
};<br />
<br />
struct assignment<br />
{<br />
&nbsp; string proj;<br />
&nbsp; float hours;<br />
&nbsp; assignment *next;<br />
};</pre><br />
Objectives:<br />
<br />
read from a file into a dynamic array of employee struct, size of array will be 3 when program starts, int ssn will serve as unique identifer. <br />
<br />
read the second file and add a new node to the employee's linked list of assigned projects. The final arrangement<br />
will be an array (dynamically allocated) of struct1 where each employee contains a pointer to a linked<br />
list of the projects to which they are assigned. The employees in the array will be in ascending order by<br />
SSN. The projects assigned to each employee will be in descending order by the hours assigned.<br />
<br />
Any tips to get me going?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>power_computer</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236679.html</guid>
		</item>
		<item>
			<title>Reading data from a file and storing into seperate variables</title>
			<link>http://www.daniweb.com/forums/thread236678.html</link>
			<pubDate>Sat, 07 Nov 2009 01:34:01 GMT</pubDate>
			<description><![CDATA[Hi all, I am trying to write code that will read from a file that is set up as an inventory file.  So, on each line you'll have something similar to: 
 
1.               Toothpaste 
2.               Toothbrush 
etc... 
 
The problem I'm having is saving the numeric item number into one array index,...]]></description>
			<content:encoded><![CDATA[<div>Hi all, I am trying to write code that will read from a file that is set up as an inventory file.  So, on each line you'll have something similar to:<br />
<br />
1.               Toothpaste<br />
2.               Toothbrush<br />
etc...<br />
<br />
The problem I'm having is saving the numeric item number into one array index, then the item description into a different array index.  The user should be able to add to the file and the program will need to sort this based on item number.  I can use getline, but don't know how to delimit it based on this type of file.  I've tried using get, but don't know how to assemble the individual characters into one array index.  Any help would be greatly appreciated, I'm new to this.  Thanks in advance.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Jalwes</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236678.html</guid>
		</item>
		<item>
			<title>Problem with passing char arrays to functions</title>
			<link>http://www.daniweb.com/forums/thread236675.html</link>
			<pubDate>Sat, 07 Nov 2009 01:15:54 GMT</pubDate>
			<description><![CDATA[Hi there, I'm assuming the answer to this problem is really easy, but I just can't work out where the problem is. It's driving me insane and I'd really appreciate some help. I'm new to C++. 
 
My problem is this: I'm trying to pass a char array to a function, where a line is read from a file and...]]></description>
			<content:encoded><![CDATA[<div>Hi there, I'm assuming the answer to this problem is really easy, but I just can't work out where the problem is. It's driving me insane and I'd really appreciate some help. I'm new to C++.<br />
<br />
My problem is this: I'm trying to pass a char array to a function, where a line is read from a file and then the array is passed back. However, the function returns gibberish - but ONLY when returning a file-derived array element. Here is my code:<br />
<br />
 <pre style="margin:20px; line-height:13px">int main ()<br />
{<br />
&nbsp; &nbsp; char* tags[128];<br />
&nbsp; &nbsp; char* file=&quot;project3.xml&quot;;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; FILE *fp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  fp=fopen(file, &quot;r&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int tits = NextTag( fp, tags );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;tags[0] post-Fn = *&quot; &lt;&lt; tags[0] &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; &quot;tags[1] post-Fn = *&quot; &lt;&lt; tags[1] &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; system(&quot;PAUSE&quot;);<br />
&nbsp; &nbsp; return 0;<br />
}<br />
<br />
int NextTag( FILE* fp, char* tags[] )<br />
{<br />
&nbsp; &nbsp; int count2 = 0;<br />
&nbsp; &nbsp; char* pch;<br />
&nbsp; &nbsp; char rida1[512];<br />
&nbsp; &nbsp; fgets(rida1, sizeof(rida1), fp);<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;rida1 in-Fn = *&quot; &lt;&lt; rida1 &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; tags[0] = &quot;bottoms&quot;;<br />
&nbsp; &nbsp; tags[1] = rida1;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;tags[0] in-Fn = *&quot; &lt;&lt; tags[0] &lt;&lt; &quot;*\n&quot;;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;tags[1] in-Fn = *&quot; &lt;&lt; tags[1] &lt;&lt; &quot;*\n&quot;;<br />
}</pre><br />
The .xml file it's reading from just contains the word 'bottoms'. Here is the output:<br />
<br />
 <pre style="margin:20px; line-height:13px">rida1 in-Fn = *bottoms*<br />
tags[0] in-Fn = *bottoms*<br />
tags[1] in-Fn = *bottoms*<br />
tags[0] post-Fn = *bottoms*<br />
tags[1] post-Fn = *L1&quot;*<br />
Press any key to continue. . .</pre><br />
Why the gibberish on line 5 of the output when it returns the manually entered entry fine? Any ideas? It's driving me insane!!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>spankboy11</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236675.html</guid>
		</item>
		<item>
			<title>I need help with deep copy constructors</title>
			<link>http://www.daniweb.com/forums/thread236664.html</link>
			<pubDate>Fri, 06 Nov 2009 23:41:23 GMT</pubDate>
			<description><![CDATA[I tried looking at the other examples on the site, but I still get segmentation errors whenever I run the file.  I need help with the constructors in *bold* in the "List" class. 
 
   <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I tried looking at the other examples on the site, but I still get segmentation errors whenever I run the file.  I need help with the constructors in <span style="font-weight:bold">bold</span> in the &quot;List&quot; class.<br />
<br />
  <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using std::cout;<br />
using std::endl;<br />
<br />
// forward declaration of List class, so ListElement can make <br />
// it a friend.&nbsp; NOTE: If List is a friend of ListElement, that<br />
// means that the List class has access to the private members<br />
// of the ListElement class, but no one else does (besides ListElement<br />
// itself). <br />
<br />
class List;<br />
class ListIterator;<br />
<br />
class ListElement {<br />
&nbsp;friend class List;<br />
&nbsp;friend class ListIterator;<br />
&nbsp;public:<br />
&nbsp;ListElement(): next(this), prev(this), isHeader(true) {}<br />
&nbsp;ListElement(int i): item(i), isHeader(false) {}<br />
&nbsp;~ListElement() {}&nbsp; // default destructor<br />
&nbsp;private:<br />
&nbsp; int item;<br />
&nbsp; ListElement *next;&nbsp; &nbsp; <br />
&nbsp; ListElement *prev;&nbsp; &nbsp; <br />
&nbsp; bool isHeader;<br />
};<br />
<br />
class ListIterator {<br />
&nbsp;friend class List;<br />
&nbsp;public:<br />
&nbsp; ListIterator() : currentPtr(NULL) { }<br />
&nbsp; ListIterator operator++(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr-&gt;next-&gt;next;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the next list node; return value is iterator *after* advancing&nbsp; <br />
&nbsp; ListIterator operator--(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr-&gt;prev-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the previous list node; return value is iterator *after* advancing<br />
&nbsp; ListIterator operator++(int){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr-&gt;next-&gt;next;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the next list node; return value is iterator *before* advancing<br />
&nbsp; ListIterator operator--(int){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;next=this-&gt;currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;currentPtr-&gt;prev=this-&gt;currentPtr-&gt;prev-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  return *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // advance iterator to the previous list node; return value is iterator *before* advancing<br />
&nbsp; int operator*(){<br />
&nbsp; &nbsp; &nbsp;  if(currentPtr-&gt;isHeader){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;error\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(1); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return currentPtr-&gt;item;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; } // return contents pointed to by iterator; print &quot;error\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; // and terminate program if iterator refers to header node<br />
&nbsp;private:<br />
&nbsp; ListElement *currentPtr;<br />
};<br />
<br />
class List {<br />
&nbsp; public:<br />
&nbsp; &nbsp; List(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp;  // creates an empty list<br />
&nbsp; &nbsp; ~List(){<br />
&nbsp; &nbsp; &nbsp; &nbsp; ListIterator *nodePtr, *nextNodePtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; nodePtr-&gt;currentPtr = head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (nodePtr-&gt;currentPtr != NULL)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; nextNodePtr-&gt;currentPtr = nodePtr-&gt;currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; delete nodePtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; nodePtr = nextNodePtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; // *must* deallocate the entire list<br />
&nbsp; &nbsp; <span style="font-weight:bold">List(const List &amp;L){<br />
&nbsp; &nbsp; &nbsp;  ListIterator lTemp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int value;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp;  lTemp.currentPtr=L.head;<br />
&nbsp; &nbsp; &nbsp;  while(lTemp.currentPtr-&gt;next!=L.head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  lTemp.currentPtr=lTemp.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=lTemp.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=this-&gt;head; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; // copy constructor (*must* be a deep copy)<br />
&nbsp; &nbsp; List &amp; operator =(List &amp;L){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }</span>&nbsp; // *must* (deep) copy list, and must avoid memory leak<br />
<br />
&nbsp; &nbsp; // these are functions to set and test the list iterator<br />
&nbsp; &nbsp; void SetStartList(ListIterator &amp;p) {p.currentPtr = head-&gt;next;}<br />
&nbsp; &nbsp; void SetEndList(ListIterator &amp;p) {p.currentPtr = head-&gt;prev;}<br />
&nbsp; &nbsp; bool IsUndefined(ListIterator p) {return (p.currentPtr == head);}<br />
&nbsp; &nbsp; bool AtEndList(ListIterator p) {return (p.currentPtr == head);}<br />
&nbsp; &nbsp; bool AtStartList(ListIterator p) {return (p.currentPtr == head);}<br />
&nbsp; &nbsp; bool AtFirstNode(ListIterator p) {return (p.currentPtr == head-&gt;next);}<br />
&nbsp; &nbsp; bool AtLastNode(ListIterator p) {return (p.currentPtr == head-&gt;prev);}<br />
&nbsp; &nbsp; // Insert integer at the beginning of the list&nbsp; <br />
&nbsp; &nbsp; void Prepend(int it){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListIterator p;&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=this-&gt;head;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(this-&gt;IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=this-&gt;head;&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // Insert integer at the end of the list<br />
&nbsp; &nbsp; void Append(int it){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ListIterator p;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(this-&gt;IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this-&gt;head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=this-&gt;head;&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{ <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // Remove first integer from list, return through first parameter.<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void Pop(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=this-&gt;head-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next-&gt;prev=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;head-&gt;next=temp-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listSize--;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Remove last integer from list, return through first parameter.<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void Pull(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement(); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=this-&gt;head-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev-&gt;next=this-&gt;head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;head-&gt;prev=temp-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  } <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; listSize--;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; // Get first integer on list, return through first parameter<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void First(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=head-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}<br />
&nbsp; &nbsp; // Get last integer on list, return through first parameter<br />
&nbsp; &nbsp; // Success is set to true if original list is nonempty, false if empty<br />
&nbsp; &nbsp; void Last(int &amp;it, bool &amp;success){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(IsEmpty()){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=false;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }&nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  success=true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp=head-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  it=temp-&gt;item;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}<br />
&nbsp; &nbsp; // insert integer before list element referred to by p<br />
&nbsp; &nbsp; void InsertBefore(int it, ListIterator p){ //may need to check if 'p' is NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(p.currentPtr-&gt;prev==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; head-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // insert integer after list element referred to by p<br />
&nbsp; &nbsp; void InsertAfter(int it, ListIterator p){ //may need to check if 'p' is NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListElement *temp= new ListElement();&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  temp-&gt;item=it;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(p.currentPtr-&gt;next==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; head-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  else{&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next-&gt;prev=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp-&gt;prev=p.currentPtr;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  listSize++;<br />
}<br />
&nbsp; &nbsp; // delete list element referred to by p; print &quot;error\n&quot;<br />
&nbsp; &nbsp; // and exit if p refers to the header node<br />
&nbsp; &nbsp; // p is undefined after this function<br />
&nbsp; &nbsp; void Delete(ListIterator p){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(p.currentPtr==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; printf(&quot;error\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exit(1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(p.currentPtr-&gt;prev==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next-&gt;prev=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  head-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (p.currentPtr-&gt;next==head){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;prev-&gt;next=head;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  head-&gt;prev=p.currentPtr-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev-&gt;next=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next-&gt;prev=p.currentPtr-&gt;prev;<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;next=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; p.currentPtr-&gt;prev=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; listSize--;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; // apply function &quot;func&quot; to each element on the list<br />
&nbsp; &nbsp; void MapFunction(void (*func)(int &amp;)){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListIterator p;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  this-&gt;AtFirstNode(p);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  for(int i=0;i&lt;listSize;i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  func(p.currentPtr-&gt;item);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}&nbsp; &nbsp;  <br />
&nbsp; &nbsp; // returns true if list empty, false otherwise<br />
&nbsp; &nbsp; bool IsEmpty(){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if(listSize==0){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  return true;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp; &nbsp;  return false;<br />
}<br />
&nbsp; &nbsp; int GetSize() {return listSize;}<br />
<br />
&nbsp; &nbsp; // must print out list elements, one per line<br />
&nbsp; &nbsp; void Print(){<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ListIterator p;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr=this-&gt;head-&gt;next;&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp;  for(int i=0;i&lt;listSize;i++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cout &lt;&lt; p.currentPtr-&gt;item &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  p.currentPtr=p.currentPtr-&gt;next;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  }<br />
}<br />
&nbsp; private:<br />
&nbsp; &nbsp; ListElement *head;<br />
&nbsp; &nbsp; int listSize;<br />
};</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>.:Pudge:.</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236664.html</guid>
		</item>
		<item>
			<title><![CDATA[help with 'for' function to construct a diamond!]]></title>
			<link>http://www.daniweb.com/forums/thread236659.html</link>
			<pubDate>Fri, 06 Nov 2009 23:19:50 GMT</pubDate>
			<description><![CDATA[Hey guys, 
I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say.  It is something like this: 
 
Prompt the user to enter (odd) height (of a diamond) and outputs the following: 
...]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
I justs started this code to make a diamond with stars (*), but I get confused how to print the spaces that I need, I don't know if you understant what I'm trying to say.  It is something like this:<br />
<br />
Prompt the user to enter (odd) height (of a diamond) and outputs the following:<br />
<br />
Example height = 7<br />
<br />
Output:<br />
<br />
<span style="color:green">****</span><span style="font-weight:bold">*</span><br />
<span style="color:green">***</span><span style="font-weight:bold">***</span><br />
<span style="color:green">**</span><span style="font-weight:bold">*****</span><br />
<span style="color:green">*</span><span style="font-weight:bold">*******</span><br />
<span style="color:green">**</span><span style="font-weight:bold">*****</span> <br />
<span style="color:green">***</span><span style="font-weight:bold">***</span><br />
<span style="color:green">****</span><span style="font-weight:bold">*</span><br />
<br />
and this is the code I'm working on, it is very basic but I'm struggling finding the mistakes and that is just the top part of the diamond:<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
#include &lt;string&gt;<br />
<br />
using namespace std;<br />
<br />
<br />
int main(){<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int h; //height<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Enter any positive number: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;h;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; int str = 1; //stars<br />
&nbsp; &nbsp; &nbsp; &nbsp; int spc = h/2; //space<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int k=0; k&lt;str; k++){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;*&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int i=0; i&lt;spc; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot; &quot;&lt;&lt;endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; str = h/2+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; spc--;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
system(&quot;PAUSE&quot;);<br />
return 0;<br />
<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>sebassn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236659.html</guid>
		</item>
		<item>
			<title>d.s. malik</title>
			<link>http://www.daniweb.com/forums/thread236645.html</link>
			<pubDate>Fri, 06 Nov 2009 21:34:13 GMT</pubDate>
			<description>salam, hope u people ll fine , any body have solved excercises of CHAP 2, CHAP 3,CHAP4 AND CHAP 5 BY D.S AMLIK book i need these urgent so kindly help me  my exams r very near n i w ant to prepare them</description>
			<content:encoded><![CDATA[<div>salam, hope u people ll fine , any body have solved excercises of CHAP 2, CHAP 3,CHAP4 AND CHAP 5 BY D.S AMLIK book i need these urgent so kindly help me  my exams r very near n i w ant to prepare them</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>IT seeker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236645.html</guid>
		</item>
		<item>
			<title>Error - Going from Java to C++</title>
			<link>http://www.daniweb.com/forums/thread236644.html</link>
			<pubDate>Fri, 06 Nov 2009 21:30:13 GMT</pubDate>
			<description><![CDATA[I have created a linked list in Java, and now I am trying to convert my program to C++.  
When I try to compile, it gives me the error saying that 'next' uses 'CarNode' which is being defined. I am wondering if there is any way around this? 
 
Java: 
  <div class="codeblock"> <div class="spaced">...]]></description>
			<content:encoded><![CDATA[<div>I have created a linked list in Java, and now I am trying to convert my program to C++. <br />
When I try to compile, it gives me the error saying that 'next' uses 'CarNode' which is being defined. I am wondering if there is any way around this?<br />
<br />
Java:<br />
 <pre style="margin:20px; line-height:13px">public class CarNode {<br />
&nbsp; public Car carObject;<br />
&nbsp; public CarNode next;<br />
<br />
&nbsp; public CarNode (Car newCar, CarNode newNext) {<br />
&nbsp; &nbsp; carObject = newCar;<br />
&nbsp; &nbsp; next = newNext;<br />
&nbsp; }<br />
}</pre><br />
<br />
C++:<br />
 <pre style="margin:20px; line-height:13px">class CarNode: public Car {<br />
&nbsp; public:<br />
&nbsp; &nbsp; Car carObject;<br />
&nbsp; &nbsp; CarNode next;<br />
<br />
&nbsp; &nbsp; CarNode(Car newCar, CarNode newNext) {<br />
&nbsp; &nbsp; &nbsp; carObject = newCar;<br />
&nbsp; &nbsp; &nbsp; next = newNext;<br />
&nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>icu222much</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236644.html</guid>
		</item>
		<item>
			<title>how to store data into a single file</title>
			<link>http://www.daniweb.com/forums/thread236635.html</link>
			<pubDate>Fri, 06 Nov 2009 20:28:58 GMT</pubDate>
			<description>hi..i am writng a program.....i have collected a lot of information(name,hobbies etc.....) of about a hundred students in my school.......i have also stored their photographs in .jpeg format.........i am using Dev c++ and windows xp..........i want to store all this info + photos in a single...</description>
			<content:encoded><![CDATA[<div>hi..i am writng a program.....i have collected a lot of information(name,hobbies etc.....) of about a hundred students in my school.......i have also stored their photographs in .jpeg format.........i am using Dev c++ and windows xp..........i want to store all this info + photos in a single file....how do i go about it............i started programmin a few days ago......so whatever u explain...please explain it in lay mans terms..........i dont want the entire code....but parts of the code ....it wud be great if you could explain it a bit n could give sources for me study it in greater detail</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>karanmehra18</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236635.html</guid>
		</item>
		<item>
			<title>Multi-Threading</title>
			<link>http://www.daniweb.com/forums/thread236630.html</link>
			<pubDate>Fri, 06 Nov 2009 19:53:57 GMT</pubDate>
			<description><![CDATA[Hey guys, 
 
I'm about to start on a research project about multi-threading.  I'm very comfortable with c++ oop/data structures concepts, but am completely new to programming with multiple threads.   Does anyone have suggested resources for me to get started?]]></description>
			<content:encoded><![CDATA[<div>Hey guys,<br />
<br />
I'm about to start on a research project about multi-threading.  I'm very comfortable with c++ oop/data structures concepts, but am completely new to programming with multiple threads.   Does anyone have suggested resources for me to get started?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Duki</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236630.html</guid>
		</item>
		<item>
			<title>How to display a variable menber of one class iside other</title>
			<link>http://www.daniweb.com/forums/thread236626.html</link>
			<pubDate>Fri, 06 Nov 2009 19:28:12 GMT</pubDate>
			<description><![CDATA[Hi I want to display a variable menber  array queue, and the definitions of the class are   <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code...]]></description>
			<content:encoded><![CDATA[<div><img src="/cgi-bin/mimetex.cgi?Hi I want to display a variable menber  array queue, and the definitions of the class are " alt="Hi I want to display a variable menber  array queue, and the definitions of the class are " border="0" /> <pre style="margin:20px; line-height:13px">The Array.h<br />
template &lt;class DataType&gt;<br />
class Array<br />
{<br />
public:<br />
Array( int size );<br />
<br />
private:<br />
T *ele;<br />
};</pre> <pre style="margin:20px; line-height:13px">[The Array.cpp<br />
Array&lt;T&gt;::Array( int size )<br />
{<br />
if ( size &lt; 1 ) {<br />
capacity = 1;<br />
<br />
}<br />
else {<br />
capacity = size;<br />
<br />
}<br />
<br />
ele = new T [capacity];<br />
}</pre> <pre style="margin:20px; line-height:13px">Q.h<br />
#include &quot;Array.h&quot;<br />
template &lt;class T&gt;<br />
class Queue<br />
{<br />
public:<br />
Queue( );<br />
void enqueue( T ele );<br />
private:<br />
Array&lt;T&gt; ele;<br />
int front;<br />
int back;<br />
};</pre> <pre style="margin:20px; line-height:13px">Q.cpp<br />
<br />
template &lt;class T&gt;<br />
Queue&lt;T&gt;::Queue( )<br />
: ele( 2 ), front( -1 ), back( -1 )<br />
{<br />
}<br />
template &lt;class T&gt;<br />
void Queue&lt;T&gt;::enqueue( T ele )]</pre><img src="/cgi-bin/mimetex.cgi? in the main I have" alt=" in the main I have" border="0" /><br />
 <pre style="margin:20px; line-height:13px">// I declare a function template fro display the queue<br />
template &lt;T&gt;<br />
void Disply(const DataType elem[] )<br />
{<br />
<br />
for( int i = 0; i&lt;6; i++)<br />
<br />
cout&lt;&lt; &quot;The elements of the Queue are:\n&quot;, i , elem[i]&lt;&lt;endl;<br />
<br />
}<br />
<br />
int main()<br />
{<br />
<br />
Queue&lt;int&gt; elementsArQueue;<br />
<br />
int array[]={1,2,3,4,5,6};<br />
<br />
for (int a=0;a&lt;6;a++)<br />
<br />
queue.enqueue(array);<br />
<br />
Display(elementsArQueue.);// give to me some errors like<br />
<br />
//P.cpp: In function âint main()â:<br />
P.cpp:48: error: no matching function for call to âDisplay(Queue&lt;int&gt;&amp;)â</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>tina05</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236626.html</guid>
		</item>
		<item>
			<title>Help in C++ Program for a Novice</title>
			<link>http://www.daniweb.com/forums/thread236623.html</link>
			<pubDate>Fri, 06 Nov 2009 19:00:58 GMT</pubDate>
			<description>I have to submit this project by this weekend.Please help me.</description>
			<content:encoded><![CDATA[<div>I have to submit this project by this weekend.Please help me.</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/txt.gif" alt="File Type: txt" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12472&amp;d=1257534026">project.txt</a> (49.4 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>mrsrinath</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236623.html</guid>
		</item>
		<item>
			<title>Is .NET good option to make a GUI in C++?</title>
			<link>http://www.daniweb.com/forums/thread236613.html</link>
			<pubDate>Fri, 06 Nov 2009 17:57:36 GMT</pubDate>
			<description>Well I think title says it very well, how do you think, is it good option to make program with GUI?</description>
			<content:encoded><![CDATA[<div>Well I think title says it very well, how do you think, is it good option to make program with GUI?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Silvershaft</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236613.html</guid>
		</item>
		<item>
			<title>C++, Visual C++ or Java for Win32API firewall application?</title>
			<link>http://www.daniweb.com/forums/thread236612.html</link>
			<pubDate>Fri, 06 Nov 2009 17:50:41 GMT</pubDate>
			<description><![CDATA[Hey guys, im about to write an application which has a visual GUI doing representation of a system (lots of pretty colours and flashing objects etc), which represent what is happening with packets and external devices being inserted into the system. 
 
I need to use one of the Win32 APIs, "Windows...]]></description>
			<content:encoded><![CDATA[<div>Hey guys, im about to write an application which has a visual GUI doing representation of a system (lots of pretty colours and flashing objects etc), which represent what is happening with packets and external devices being inserted into the system.<br />
<br />
I need to use one of the Win32 APIs, &quot;Windows Filtering Platform&quot;, so what would be better to use, Visual C++ or C++? Also, as i am not quite sure between the difference, what is it?<br />
<br />
In the past i have done GUIs using java (repaint(), canvas etc) and wondered is it pretty much the same in C++?<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>futureaussiecto</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236612.html</guid>
		</item>
		<item>
			<title>how to display wrong input if i using switch??</title>
			<link>http://www.daniweb.com/forums/thread236608.html</link>
			<pubDate>Fri, 06 Nov 2009 17:09:09 GMT</pubDate>
			<description>i need help with this very simple question.... 
the default in this program will just display the wrong input 
if the input entered by user is different with the data type of the variable which is char.. 
but not if the user entered the the word which is the character is located in front of the...</description>
			<content:encoded><![CDATA[<div>i need help with this very simple question....<br />
the <span style="font-style:italic">default</span> in this program will just display the <span style="font-style:italic">wrong input</span><br />
if the input entered by user is different with the data type of the variable which is <span style="font-style:italic">char</span>..<br />
but not if the user entered the the word which is the character is located in front of the word...<br />
<br />
in my program, if the user entered apple instead of 'a',this program will still print that i'm in the red team...<br />
<br />
I want this program to display the<span style="font-style:italic"> input error</span>.. <br />
<br />
this is my code :<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
int main () {<br />
<br />
char answer;<br />
<br />
cout&lt;&lt;&quot;Enter Your Team :&quot;;<br />
cin&gt;&gt;answer;<br />
<br />
switch (answer) {<br />
&nbsp; &nbsp; case 'a' :<br />
&nbsp; &nbsp;  cout&lt;&lt;&quot;You in the Red Team&quot;;<br />
&nbsp; &nbsp;  break;<br />
<br />
&nbsp; &nbsp; case 'b' :<br />
&nbsp; &nbsp;  cout&lt;&lt;&quot;You in the blue team&quot;;<br />
&nbsp; &nbsp;  break;<br />
<br />
&nbsp; &nbsp; default :<br />
&nbsp; &nbsp;  cout&lt;&lt;&quot;wrong input&quot;;<br />
&nbsp; &nbsp;  break;<br />
}<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>samsons17</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236608.html</guid>
		</item>
		<item>
			<title>2 variables in for loop</title>
			<link>http://www.daniweb.com/forums/thread236605.html</link>
			<pubDate>Fri, 06 Nov 2009 16:49:54 GMT</pubDate>
			<description>I am trying to increment 2 variables in a for loop and i want the loop to exit when the highest value variable is reached 
 
My example *a *gets the first element of a vector and *f *gets the next.  It needs to keep doing that until *f* reaches the last vector and *a *gets the first from last...</description>
			<content:encoded><![CDATA[<div>I am trying to increment 2 variables in a for loop and i want the loop to exit when the highest value variable is reached<br />
<br />
My example <span style="font-weight:bold">a </span>gets the first element of a vector and <span style="font-weight:bold">f </span>gets the next.  It needs to keep doing that until <span style="font-weight:bold">f</span> reaches the last vector and <span style="font-weight:bold">a </span>gets the first from last vector<br />
<br />
If i take it out the loop and put values in the vec.at() i get a value<br />
<br />
There are my values<br />
 <pre style="margin:20px; line-height:13px">vec.push_back(&quot;!&quot;);<br />
&nbsp; &nbsp; vec.push_back(&quot;=&quot;);<br />
&nbsp; &nbsp; vec.push_back(&quot;and&quot;);<br />
&nbsp; &nbsp; vec.push_back(&quot;bee&quot;);<br />
&nbsp; &nbsp; vec.push_back(&quot;=&quot;);<br />
&nbsp; &nbsp; vec.push_back(&quot;=&quot;);<br />
&nbsp; &nbsp; vec.push_back(&quot;car&quot;);</pre><br />
and this is my code example<br />
<br />
 <pre style="margin:20px; line-height:13px">for(int a=0, f=0; a &lt; vec.size(); a++)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; f++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(f &lt; vec.size())<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rel1 = vec.at(a);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rel2 = vec.at(f);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vector&lt;string&gt; relation = JoinRelation(rel1, rel2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
at the moment nothing is getting output or saved in a new vector so it is the for loop causing problems</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>AdRock</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236605.html</guid>
		</item>
		<item>
			<title>Can someone enlighten me on Deep Copy Problem?</title>
			<link>http://www.daniweb.com/forums/thread236589.html</link>
			<pubDate>Fri, 06 Nov 2009 15:33:29 GMT</pubDate>
			<description><![CDATA[I have an function in which I want to make a copy of an object.  
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags"...]]></description>
			<content:encoded><![CDATA[<div>I have an function in which I want to make a copy of an object. <br />
<br />
 <pre style="margin:20px; line-height:13px">ClassBase<br />
{<br />
public:<br />
Tblk myTblk;<br />
private:<br />
<br />
};<br />
<br />
void ClassBase::CopyObject(const ClassBase &amp;test)<br />
{<br />
&nbsp; &nbsp; &nbsp;  TblkPtr_t myTblk = TblkPtr_t(new Tblk); //TblkPtr_t is a typedef shared pointer<br />
&nbsp; &nbsp; &nbsp; *myTblk = *test.myTblk;<br />
}</pre><br />
For some reason that doesn't work. If I use the copy constructor like this<br />
<br />
 <pre style="margin:20px; line-height:13px">myTblk = new Tblk(*test.myTblk)</pre><br />
then it seems to work. I don't understand why if I dereference the pointer in my original example why it wouldn't work. Can someone enlighten me?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Niner710</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236589.html</guid>
		</item>
		<item>
			<title>Sorting Algorithms</title>
			<link>http://www.daniweb.com/forums/thread236552.html</link>
			<pubDate>Fri, 06 Nov 2009 11:53:58 GMT</pubDate>
			<description>I need Help! 
 
Consider this following modified version of the binary search algorithm. (Modifications are indicated by a comment highlighted asterisks.) With this new version of the binary search algorithmn work correctly for all data? If not, specify a situiation in which this version will fail....</description>
			<content:encoded><![CDATA[<div>I need Help!<br />
<br />
Consider this following modified version of the binary search algorithm. (Modifications are indicated by a comment highlighted asterisks.) With this new version of the binary search algorithmn work correctly for all data? If not, specify a situiation in which this version will fail.<br />
<br />
 <pre style="margin:20px; line-height:13px">template&lt;class element, class Keytype&gt;<br />
bool binarySearch(const apvector&lt;element&gt; &amp;list, int n, Keytype target, element &amp;object)<br />
<br />
{<br />
int low, middle, high;<br />
bool found = false;<br />
<br />
low = 0;<br />
high = n;<br />
while ((low &lt;= high) &amp;&amp; ! found)<br />
{<br />
middle = (low + high) / 2;<br />
if(list[middle] = target)<br />
found=true;<br />
else if (list[middle] &lt; target)<br />
low = middle;&nbsp; // *** MODIFICATION HERE ***<br />
else<br />
high = middle; // *** MODIFICATION HERE ***<br />
}<br />
if (found)<br />
object=list[middle];<br />
return found;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>saintrenz</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236552.html</guid>
		</item>
		<item>
			<title>Delano</title>
			<link>http://www.daniweb.com/forums/thread236544.html</link>
			<pubDate>Fri, 06 Nov 2009 10:48:20 GMT</pubDate>
			<description><![CDATA[While I was browsing through the forum threads long ago, i saw a thread about one assignment given toits poster. 
Since i am learning myself(1 month left to enter university), I decided to try writing d program . Please, you are free to correct me if I am wrong anywhere... 
  <div...]]></description>
			<content:encoded><![CDATA[<div>While I was browsing through the forum threads long ago, i saw a thread about one assignment given toits poster.<br />
Since i am learning myself(1 month left to enter university), I decided to try writing d program . Please, you are free to correct me if I am wrong anywhere...<br />
 <pre style="margin:20px; line-height:13px">#include&lt;iostream&gt;<br />
#include&lt;fstream&gt;<br />
#include&lt;string&gt;<br />
#include&lt;ctime&gt;<br />
#include&lt;cstdlib&gt;<br />
#include&lt;vector&gt;<br />
using namespace std;<br />
void wait(int seconds){<br />
clock_t endwait;<br />
endwait=clock()+seconds*CLOCKS_PER_SEC;<br />
while(clock()&lt;endwait){}<br />
}<br />
<br />
int main()<br />
{<br />
&nbsp;int a=0;int b=0;int c=0;<br />
&nbsp;int accum=0;<br />
&nbsp;int con=0;<br />
&nbsp;int thr=0;<br />
&nbsp;int score=0;<br />
&nbsp;cout&lt;&lt;&quot;Welcome to the workable version of Delano, a dice game&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Checking for savedata..&quot;&lt;&lt;endl;<br />
&nbsp;wait(3);<br />
&nbsp;ifstream fin(&quot;savedata.tkud&quot;);<br />
&nbsp;if(!fin){<br />
&nbsp;cout&lt;&lt;&quot;No savedata was found in memory!!&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Create savedata ?(1)Yes,(2)No&quot;;<br />
&nbsp;cin&gt;&gt;con;<br />
&nbsp;if(con!=1){}<br />
&nbsp;if(con==1){<br />
&nbsp;ofstream fout(&quot;savedata.tkud&quot;);<br />
&nbsp;fout&lt;&lt;score&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Savedata successfully created!!&quot;&lt;&lt;endl;<br />
&nbsp;}<br />
&nbsp;}<br />
&nbsp;if(fin){<br />
&nbsp;cout&lt;&lt;&quot;Savedata found!!&quot;&lt;&lt;endl;<br />
&nbsp;fin&gt;&gt;score;<br />
&nbsp;cout&lt;&lt;&quot;g &quot;&lt;&lt;score&lt;&lt;endl;<br />
&nbsp;}<br />
&nbsp;cout&lt;&lt;&quot;Loading....&quot;&lt;&lt;endl;<br />
&nbsp;wait(5);<br />
&nbsp;cout&lt;&lt;&quot;Here are the rules..&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;The die is from 1 to 5..&quot;&lt;&lt;endl&lt;&lt;&quot;A player throws three dice consecutively..&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;If,at the end of the game, the player's score is divisible by 5, 1000 pts. are awarded to the player..&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;500 pts. are awarded if all 3 throws are identical..&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;If only 2 match, 300 pts. are awarded..&quot;&lt;&lt;endl&lt;&lt;&quot;200 pts. are removed if none match&quot;&lt;&lt;endl&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Do you wish to continue( (0)Quit,(1)Continue )?&quot;;<br />
&nbsp;cin&gt;&gt;con;<br />
&nbsp;if(con!=1){<br />
&nbsp;cout&lt;&lt;&quot;Thank you all the same!!&quot;&lt;&lt;endl;<br />
&nbsp;return 1;<br />
&nbsp;}<br />
&nbsp;cout&lt;&lt;&quot;Good luck!!&quot;&lt;&lt;endl;<br />
&nbsp;while(con==1){<br />
&nbsp;//Game begins!!<br />
&nbsp;cout&lt;&lt;&quot;To roll a die, press any number and then hit enter..&quot;&lt;&lt;endl;<br />
&nbsp;cin&gt;&gt;thr;<br />
&nbsp;cout&lt;&lt;&quot;Rolling...&quot;&lt;&lt;endl;<br />
&nbsp;wait(3);<br />
&nbsp;srand(time(NULL));<br />
&nbsp;a=rand()%6;//Between 0 and 5<br />
&nbsp;cout&lt;&lt;&quot;You threw a &quot;&lt;&lt;a&lt;&lt;&quot;!!&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Throw another..&quot;;<br />
&nbsp;cin&gt;&gt;thr;<br />
&nbsp;cout&lt;&lt;&quot;Rolling..&quot;&lt;&lt;endl;<br />
&nbsp;wait(3);<br />
&nbsp;b=rand()%6;<br />
&nbsp;cout&lt;&lt;&quot;You threw a &quot;&lt;&lt;b&lt;&lt;&quot;!!&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Throw another..&quot;;<br />
&nbsp;cin&gt;&gt;thr;<br />
&nbsp;cout&lt;&lt;&quot;Rolling..&quot;;<br />
&nbsp;wait(3);<br />
&nbsp;c=rand()%6;<br />
&nbsp;cout&lt;&lt;&quot;You threw a &quot;&lt;&lt;c&lt;&lt;&quot;!!&quot;&lt;&lt;endl&lt;&lt;endl;<br />
&nbsp;wait(2);<br />
&nbsp;cout&lt;&lt;&quot;*****************************PLAYER STATS*************************************&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Initial score: &quot;&lt;&lt;score&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Dice results...&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Throw 1: &quot;&lt;&lt;a&lt;&lt;endl&lt;&lt;&quot;Throw 2: &quot;&lt;&lt;b&lt;&lt;endl&lt;&lt;&quot;Throw 3: &quot;&lt;&lt;c&lt;&lt;endl&lt;&lt;endl;<br />
&nbsp;accum=a+b+c;<br />
&nbsp;cout&lt;&lt;&quot;A&quot;&lt;&lt;accum&lt;&lt;endl; <br />
&nbsp;cout&lt;&lt;&quot;Total: &quot;&lt;&lt;accum&lt;&lt;endl;<br />
&nbsp;//Time for score processing!!<br />
&nbsp;if(accum%5==0)<br />
&nbsp;score=score+1000;<br />
&nbsp;<br />
&nbsp;else if(a==b==c)<br />
&nbsp;score=score+500;<br />
&nbsp;<br />
&nbsp;<br />
&nbsp;else if(a==b|a==c|b==c)<br />
&nbsp;score=score+300;<br />
&nbsp;<br />
&nbsp; <br />
&nbsp;else if(a!=b&amp;a!=c&amp;b!=c)<br />
&nbsp;score=score-200;<br />
&nbsp;cout&lt;&lt;&quot;New score: &quot;&lt;&lt;score&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;*******************************************************************************&quot;&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Do you want to save yor game progress((1)Yes,(2)No)?&quot;;<br />
&nbsp;cin&gt;&gt;con;<br />
&nbsp;if(con!=1){}<br />
&nbsp;if(con==1){<br />
&nbsp;ofstream fout(&quot;savedata.tkud&quot;);<br />
&nbsp;fout&lt;&lt;score&lt;&lt;endl;<br />
&nbsp;cout&lt;&lt;&quot;Savedata successfully created!!&quot;&lt;&lt;endl;<br />
&nbsp;}<br />
&nbsp;cout&lt;&lt;&quot;Do you wish to continue?(1)Yes,(2)No&quot;;<br />
&nbsp;cin&gt;&gt;con;<br />
&nbsp;if(con!=1){<br />
&nbsp;cout&lt;&lt;&quot;Thank you all the same!!&quot;&lt;&lt;endl;<br />
&nbsp;return 1;<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;}//end of while<br />
&nbsp;<br />
&nbsp;cout&lt;&lt;&quot;Thank you for using the workable versoin of Delano, a dice game&quot;&lt;&lt;endl;<br />
&nbsp;return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>tkud</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236544.html</guid>
		</item>
		<item>
			<title>C++ quick question, array</title>
			<link>http://www.daniweb.com/forums/thread236498.html</link>
			<pubDate>Fri, 06 Nov 2009 07:03:06 GMT</pubDate>
			<description><![CDATA[My array keeps outputting this random character (kind of like a # in a box). Anyways, its just garbage really, but how do i stop it from doing this. 
 
If my array was like 
 
char title[10] 
 
and the user inputted something with only 5 characters, then the remaining characters would be the...]]></description>
			<content:encoded><![CDATA[<div>My array keeps outputting this random character (kind of like a # in a box). Anyways, its just garbage really, but how do i stop it from doing this.<br />
<br />
If my array was like<br />
<br />
char title[10]<br />
<br />
and the user inputted something with only 5 characters, then the remaining characters would be the garbage character. <br />
<br />
How do I stop this?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>EastJohn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236498.html</guid>
		</item>
		<item>
			<title>overloading assignment operator problem</title>
			<link>http://www.daniweb.com/forums/thread236481.html</link>
			<pubDate>Fri, 06 Nov 2009 05:14:13 GMT</pubDate>
			<description><![CDATA[here is the overloaded function i have. I have to enter a float, for example, .123 or 0.123. if there is many zeros in front, then it will skip them over, and test for a decimal, then count the numbers in the end. and then print them out. 
 
  <div class="codeblock"> <div class="spaced"> <div...]]></description>
			<content:encoded><![CDATA[<div>here is the overloaded function i have. I have to enter a float, for example, .123 or 0.123. if there is many zeros in front, then it will skip them over, and test for a decimal, then count the numbers in the end. and then print them out.<br />
<br />
 <pre style="margin:20px; line-height:13px">MyFloat&amp; MyFloat::operator= (const char RightSide[])<br />
{<br />
&nbsp; &nbsp; char ch;<br />
&nbsp; &nbsp; int k = 0;<br />
&nbsp;  <br />
&nbsp; &nbsp; NumberOfDigits = 0;&nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; if ( !cin.good() || (ch != '0' &amp;&amp; ch != '.'))<br />
&nbsp; &nbsp; &nbsp; &nbsp; return *this;<br />
<br />
&nbsp; &nbsp; while( ch == '0' ||&nbsp; isspace(ch))&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.get(ch);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; if (ch != '.')<br />
&nbsp; &nbsp; &nbsp; &nbsp; return *this;<br />
<br />
&nbsp; &nbsp; cin.get(ch);<br />
<br />
&nbsp; &nbsp; while(isdigit(ch) &amp;&amp; k &lt; RightSide[k])&nbsp; <br />
&nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  Number[k] = ch - '0';&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  k++;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cin.get(ch);<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; NumberOfDigits = k;<br />
&nbsp; &nbsp; cin.putback(ch);<br />
<br />
&nbsp; &nbsp; for(k; k &lt; MAX_DIGITS; k++)&nbsp; &nbsp; //insert an end buffer of zeros<br />
&nbsp; &nbsp; &nbsp; &nbsp; Number[k] = 0;<br />
<br />
&nbsp; return *this;<br />
}</pre><br />
here is the code that is used to test the overloaded function:<br />
<br />
 <pre style="margin:20px; line-height:13px">void TestAssignment()<br />
{<br />
&nbsp; MyFloat X;<br />
&nbsp; char&nbsp; &nbsp; X_Str[100];<br />
<br />
&nbsp; cout &lt;&lt; &quot;\n------------&nbsp; Testing \&quot;=\&quot; for MyFloat --------------------\n&quot;;<br />
&nbsp; do<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;\nEnter string holding float: &quot;;<br />
&nbsp;<br />
&nbsp; &nbsp; cin.getline(X_Str, 100);<br />
<br />
&nbsp; &nbsp; X = X_Str;&nbsp; // Call MyFloat = operator<br />
<br />
&nbsp; &nbsp; if ( X.Digits() == 0 )&nbsp; &nbsp; &nbsp;  //&nbsp; Error in string format<br />
&nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\nFormat error! &quot;;<br />
<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;\nAfter assignment,&nbsp; &nbsp;  'X = &quot;&lt;&lt; X &lt;&lt; &quot;'&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; }<br />
&nbsp; while ( SpaceBarToContinue() );<br />
}</pre><br />
the problem i am having with this is that it is going right into the if statement if i initialize ch with zero. but then if i put cin.get(ch) between the NumberOfDigits and the if statement, it works, but since there is the cin.getline in the testing function, it asks for a number twice, and i dont want it to do that. help?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>ninreznorgirl2</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236481.html</guid>
		</item>
		<item>
			<title>how to display this using for loop??</title>
			<link>http://www.daniweb.com/forums/thread236472.html</link>
			<pubDate>Fri, 06 Nov 2009 04:22:46 GMT</pubDate>
			<description>how do i display something like this using for loop? 
 
0 
2 4 6 8 10 12 14 
18 24 26 28 30 32 
 
thank you for helping...</description>
			<content:encoded><![CDATA[<div>how do i display something like this using for loop?<br />
<br />
0<br />
2 4 6 8 10 12 14<br />
18 24 26 28 30 32<br />
<br />
thank you for helping...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>samsons17</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236472.html</guid>
		</item>
		<item>
			<title>does anyone know to do program like peteranswers??</title>
			<link>http://www.daniweb.com/forums/thread236466.html</link>
			<pubDate>Fri, 06 Nov 2009 04:04:13 GMT</pubDate>
			<description><![CDATA[does anyone know how to do the program that are more or less like peteranswers?? 
 
This is the website which has been using to trick people... 
http://www.peteranswers.com/ 
 
and this is the secret : 
http://chriswondra.com/2007/02/21/peter-answers-the-secret/ 
 
i'm just wondering if i'm capable...]]></description>
			<content:encoded><![CDATA[<div>does anyone know how to do the program that are more or less like peteranswers??<br />
<br />
This is the website which has been using to trick people...<br />
<a rel="nofollow" class="t" href="http://www.peteranswers.com/" target="_blank">http://www.peteranswers.com/</a><br />
<br />
and this is the secret :<br />
<a rel="nofollow" class="t" href="http://chriswondra.com/2007/02/21/peter-answers-the-secret/" target="_blank">http://chriswondra.com/2007/02/21/pe...rs-the-secret/</a><br />
<br />
i'm just wondering if i'm capable to do just a simple program that is similar like this?<br />
and how to do this if i could?<br />
<br />
thank you 4 answering...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>samsons17</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236466.html</guid>
		</item>
		<item>
			<title>how to display this using for loop??</title>
			<link>http://www.daniweb.com/forums/thread236460.html</link>
			<pubDate>Fri, 06 Nov 2009 03:48:24 GMT</pubDate>
			<description>how do i display something like this using for loop? 
 
0 
2 4 6 8 10 12 14   
18 24 26 28 30 32 
 
thank you for helping...</description>
			<content:encoded><![CDATA[<div>how do i display something like this using <span style="font-style:italic">for loop</span>?<br />
<br />
0<br />
2 4 6 8 10 12 14  <br />
18 24 26 28 30 32<br />
<br />
thank you for helping...</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>samsons17</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236460.html</guid>
		</item>
		<item>
			<title>Problems with functions</title>
			<link>http://www.daniweb.com/forums/thread236457.html</link>
			<pubDate>Fri, 06 Nov 2009 03:40:39 GMT</pubDate>
			<description><![CDATA[I have tried the two ways below to get my functions to call and run, but VS gives me the error 
 
error c2660: .....  function does not take 0 arguments 
 
First way tried  
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>I have tried the two ways below to get my functions to call and run, but VS gives me the error<br />
<br />
error c2660: .....  function does not take 0 arguments<br />
<br />
First way tried <br />
 <pre style="margin:20px; line-height:13px">//Michelle CSI 130 Lab 11 Part 2 Section B<br />
//Digital logic and Boolean algebra<br />
#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
int count (int I, int N)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a running count, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Number count.&nbsp; &nbsp; <br />
&nbsp; &nbsp; I=0, N=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; N;<br />
&nbsp; &nbsp; N=N;<br />
&nbsp; &nbsp; I=I+1;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; while (N&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; N;<br />
&nbsp; &nbsp; &nbsp; &nbsp; N=N;<br />
&nbsp; &nbsp; &nbsp; &nbsp; I=I+1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return I;<br />
}<br />
<br />
int avg (int i, int n, int avg, int sum)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like, it keeps a running count and average, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Number average.&nbsp; &nbsp; <br />
&nbsp; &nbsp; i=0, n=0, avg=0, sum=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; sum=n;<br />
&nbsp; &nbsp; i=i+1;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; while (n&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; sum=sum+n;<br />
&nbsp; &nbsp; i=i+1;<br />
&nbsp; &nbsp; avg=sum/i;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return avg;<br />
}<br />
<br />
int Highest (int n, int large)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of highest number, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Highest number.&nbsp; &nbsp; <br />
&nbsp; &nbsp; n=0, large=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; large=n;<br />
<br />
&nbsp; &nbsp; while (n&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (n&gt;large)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; large=n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return large;<br />
}<br />
<br />
int Lowest (int n, int low)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of lowest number, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Lowest number.&nbsp; &nbsp; <br />
&nbsp; &nbsp; n=0, low=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; low=n;<br />
<br />
&nbsp; &nbsp; while (n&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (n&lt;low)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; low=n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; return low;<br />
}<br />
<br />
<br />
<br />
int main()<br />
{//PURPOSE: Allows the user to enter their choice of which calculation they would like to make of the numbers they enter.<br />
//INPUT: Users choice and stored in Choice.<br />
//OUTPUT: None.&nbsp; &nbsp; <br />
&nbsp; &nbsp; int Choice;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Please choose an option\n&quot; &lt;&lt; &quot;1. Count the number of entries.\n&quot; &lt;&lt; &quot;2. Calculate the average.\n&quot; &lt;&lt; &quot;3. Determine the highest number.\n&quot; &lt;&lt; &quot;4. Determine the lowest number.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; Choice;<br />
&nbsp; &nbsp; if (Choice==1)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cout &lt;&lt; count();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if(Choice==2)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cout &lt;&lt; avg();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if (Choice==3)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cout &lt;&lt; Highest();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else <br />
&nbsp; &nbsp; {&nbsp; &nbsp; cout &lt;&lt; Lowest();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; return 0;<br />
}</pre><br />
second way tried <br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
void count (int I, int N)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a running count, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Number count.&nbsp; &nbsp; <br />
&nbsp; &nbsp; I=0, N=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; N;<br />
&nbsp; &nbsp; N=N;<br />
&nbsp; &nbsp; I=I+1;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; while (N&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; N;<br />
&nbsp; &nbsp; &nbsp; &nbsp; N=N;<br />
&nbsp; &nbsp; &nbsp; &nbsp; I=I+1;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Number count is: &quot; &lt;&lt; I;<br />
}<br />
<br />
void avg (int i, int n, int avg, int sum)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like, it keeps a running count and average, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Number average.&nbsp; &nbsp; <br />
&nbsp; &nbsp; i=0, n=0, avg=0, sum=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; sum=n;<br />
&nbsp; &nbsp; i=i+1;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; while (n&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; sum=sum+n;<br />
&nbsp; &nbsp; i=i+1;<br />
&nbsp; &nbsp; avg=sum/i;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Number average is: &quot; &lt;&lt; avg;<br />
}<br />
<br />
void Highest (int n, int large)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of highest number, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Highest number.&nbsp; &nbsp; <br />
&nbsp; &nbsp; n=0, large=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; large=n;<br />
<br />
&nbsp; &nbsp; while (n&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (n&gt;large)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; large=n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Largest number is: &quot; &lt;&lt; large;<br />
}<br />
<br />
void Lowest (int n, int low)<br />
{//PURPOSE: Allows the user to enter as many numbers as they like and keeps a record of lowest number, till they end with -1.<br />
//INPUT: Number will be entered one at a time and stored in n.<br />
//OUTPUT: Lowest number.&nbsp; &nbsp; <br />
&nbsp; &nbsp; n=0, low=0;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Enter positive numbers one at a time.\n&quot; &lt;&lt; &quot;When complete enter -1.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; low=n;<br />
<br />
&nbsp; &nbsp; while (n&gt;=0)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while (n&lt;low)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; low=n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Smallest number is: &quot; &lt;&lt; low;<br />
}<br />
<br />
<br />
<br />
int main()<br />
{//PURPOSE: Allows the user to enter their choice of which calculation they would like to make of the numbers they enter.<br />
//INPUT: Users choice and stored in Choice.<br />
//OUTPUT: None.&nbsp; &nbsp; <br />
&nbsp; &nbsp; int Choice;<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Please choose an option\n&quot; &lt;&lt; &quot;1. Count the number of entries.\n&quot; &lt;&lt; &quot;2. Calculate the average.\n&quot; &lt;&lt; &quot;3. Determine the highest number.\n&quot; &lt;&lt; &quot;4. Determine the lowest number.\n&quot;;<br />
&nbsp; &nbsp; cin &gt;&gt; Choice;<br />
&nbsp; &nbsp; if (Choice==1)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; count();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if(Choice==2)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; avg();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else if (Choice==3)<br />
&nbsp; &nbsp; {&nbsp; &nbsp; Highest();<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; else <br />
&nbsp; &nbsp; {&nbsp; &nbsp; Lowest();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; return 0;<br />
}</pre><br />
Any help is appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>mitchstokes225</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236457.html</guid>
		</item>
		<item>
			<title><![CDATA[Help with "simple for some" c++ output problem..]]></title>
			<link>http://www.daniweb.com/forums/thread236452.html</link>
			<pubDate>Fri, 06 Nov 2009 02:55:46 GMT</pubDate>
			<description>Hello, 
 
I am having trouble with one of my assignments and was hoping someone could help explain why this problem is occurring. 
 
The following code is set up to ask the user if they would like another transaction after they have completed the program.  The first time the user inputs data the...</description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
I am having trouble with one of my assignments and was hoping someone could help explain why this problem is occurring.<br />
<br />
The following code is set up to ask the user if they would like another transaction after they have completed the program.  The first time the user inputs data the output stays in its proper format, but if the user elects to perform another transaction the table in the output is manipulated..   <br />
<br />
Here is the code and below it is a description of the problematic output ...  <br />
<br />
Help would be greatly appreciated and any advice on how I have written the code or about anything is greatly appreciated ..<br />
<br />
<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt; <br />
#include &lt;iomanip&gt;<br />
#include &lt;cstring&gt;<br />
using namespace std;<br />
<br />
int main ()<br />
<br />
{<br />
<br />
&nbsp; &nbsp; //Use do to mark the start of the loop and introduce variable needed outside of loop scope.<br />
<br />
&nbsp; &nbsp; char additional_Transaction ;<br />
&nbsp; &nbsp; do<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
<br />
&nbsp; &nbsp; //Declaring variables<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; char date[10];<br />
&nbsp; &nbsp; int quantity;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char isbn[18];<br />
&nbsp; &nbsp; &nbsp; &nbsp; char title[35];<br />
&nbsp; &nbsp; &nbsp; &nbsp; float price;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Asks the user to enter p.o.s data<br />
<br />
<br />
&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;endl &lt;&lt; &quot;Please enter todays date in the following format&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot; MM/DD/YY: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; date; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the quantity of the book being purchased: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; quantity;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the books ISBN of the book being purchased: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; isbn;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.ignore();<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the title of the book being purchased: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.getline (title, 35);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the price of the book being purchased: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; price;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl &lt;&lt; endl;<br />
<br />
<br />
<br />
<br />
<br />
&nbsp; &nbsp; //Displays information entered by user <br />
<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Serendipity Booksellers\n&nbsp; Cashier Module&quot; &lt;&lt; endl &lt;&lt; endl &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Date: &quot; &lt;&lt; date &lt;&lt; endl ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Quantity: &quot; &lt;&lt; quantity &lt;&lt; endl ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ISBN: &quot; &lt;&lt; isbn &lt;&lt; endl ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Title: &quot; &lt;&lt; title &lt;&lt; endl ; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Price: $&quot; &lt;&lt; price &lt;&lt; endl ; <br />
<br />
&nbsp; &nbsp; //Introducing new variables, and performs calculations<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; float subtotal = price + quantity ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; double tax = subtotal * .06 ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; float total = subtotal + tax ;<br />
<br />
&nbsp; &nbsp; //Displays information <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;endl &lt;&lt;endl &lt;&lt; &quot;\t\t\t\t&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Serendipity Booksellers&quot; &lt;&lt;endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;endl &lt;&lt;endl &lt;&lt; &quot;Date:&quot; &lt;&lt; date &lt;&lt;endl &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Qty&quot; &lt;&lt; setw(9) &lt;&lt; &quot;ISBN&quot; &lt;&lt; setw(16) &lt;&lt; &quot;Title&quot; &lt;&lt; setw(25) &lt;&lt;&quot;&nbsp; &nbsp; Price&quot; &lt;&lt; setw(20)&lt;&lt; &quot;Total&quot; &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;&quot;__________________________________________________________________________________________&quot; &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; quantity &lt;&lt; &quot;&nbsp; &nbsp; &nbsp; &quot; ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; setw(15) &lt;&lt; left &lt;&lt; isbn ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; setw(26) &lt;&lt; left &lt;&lt; title ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; setprecision(2) &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; &quot;$&quot; &lt;&lt; price ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; setprecision(2) &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt; &quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $&quot; &lt;&lt; left &lt;&lt; total ;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;endl &lt;&lt;endl &lt;&lt;endl &lt;&lt; setprecision(2) &lt;&lt; showpoint &lt;&lt; fixed &lt;&lt;&quot;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  Subtotal&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  $ &quot; &lt;&lt; subtotal &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; setprecision(2) &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt;&quot;\t\t&nbsp;  Tax&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ &quot; &lt;&lt; tax &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; setprecision(2) &lt;&lt; fixed &lt;&lt; showpoint &lt;&lt;&quot;\t\t&nbsp;  Total&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ &quot; &lt;&lt; total &lt;&lt;endl &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;endl &lt;&lt; &quot;\t&nbsp; &nbsp; &nbsp;  Thank You for Shopping at Serendipity!&quot; &lt;&lt;endl &lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\t&nbsp; &nbsp; &nbsp;  Would you like to preform another transaction? &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; additional_Transaction;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl &lt;&lt; endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Declare the conditions of the loops repeat execution with while <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; }while ( additional_Transaction == 'Y' || additional_Transaction == 'y' );<br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; //Output for program exit&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\t&nbsp; &nbsp; &nbsp;  Thank You, have a nice day.\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
<br />
&nbsp; &nbsp; return 0;<br />
<br />
}</pre><br />
<br />
In the first iteration The table headings(Qty,ISBN,Title,Price,Total) are spaced properly <br />
<br />
In any additional iteration the table headings scrunch up to the left ...<br />
<br />
Can someone please help.<br />
<br />
Thanks !<br />
<br />
Colin</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>squigworm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236452.html</guid>
		</item>
		<item>
			<title>Input file stream -- endless loop</title>
			<link>http://www.daniweb.com/forums/thread236442.html</link>
			<pubDate>Fri, 06 Nov 2009 01:51:47 GMT</pubDate>
			<description><![CDATA[Hello, 
 
    I've checked google now intermidintly for two days, and I could not find a solution for my problem, so I decided I would post my own thread on here. 
 
    The program I'm designing is supposed to ask the user for a file name, open that file, then take the average and  find the least...]]></description>
			<content:encoded><![CDATA[<div>Hello,<br />
<br />
    I've checked google now intermidintly for two days, and I could not find a solution for my problem, so I decided I would post my own thread on here.<br />
<br />
    The program I'm designing is supposed to ask the user for a file name, open that file, then take the average and  find the least and greatest.  My problem is, my program is getting stuck just accepting data from a file, and I'm not sure why.  It never even gets to any of my functions.<br />
<br />
Here's some of my code:<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;iomanip&gt;<br />
using namespace std;<br />
<br />
void Average(double NumbersFromFile[50], int);<br />
void Least(double NumbersFromFile[50], int);<br />
void Greatest(double NumbersFromFile[50], int);<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; int Counter=0;<br />
&nbsp; &nbsp; double NumbersFromFile[50]={0};<br />
&nbsp; &nbsp; char FileName[50]={0};<br />
<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;What is the name of you file?&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; cin &gt;&gt; FileName;<br />
<br />
&nbsp; &nbsp; ifstream InputFile;<br />
&nbsp; &nbsp; InputFile.open(FileName);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;  if(InputFile)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Error!&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; while(!InputFile.eof())<br />
&nbsp; &nbsp;  {&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; InputFile &gt;&gt; NumbersFromFile[Counter];<br />
&nbsp; &nbsp; &nbsp; &nbsp; Counter++;<br />
&nbsp; &nbsp;  }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; InputFile.close();<br />
<br />
&nbsp; &nbsp; Least(NumbersFromFile, Counter);<br />
&nbsp; &nbsp; Greatest(NumbersFromFile, Counter);<br />
&nbsp; &nbsp; Average(NumbersFromFile, Counter);<br />
<br />
&nbsp; &nbsp; return 0;<br />
<br />
<br />
}</pre><br />
Any help would be greatly appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>PolarPear</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236442.html</guid>
		</item>
		<item>
			<title>Viewing a buffer when using std::string advice.</title>
			<link>http://www.daniweb.com/forums/thread236439.html</link>
			<pubDate>Fri, 06 Nov 2009 01:26:59 GMT</pubDate>
			<description><![CDATA[I have a task to do about the std::string datatype.  
 
To do the task I need to Use KDevelop and be able to find the size of the buffer being used when performing operations upon strings, but never having used KDevelop before, I'm at a complete loss. 
 
Could anyone be so kind as to give me some...]]></description>
			<content:encoded><![CDATA[<div>I have a task to do about the std::string datatype. <br />
<br />
To do the task I need to Use KDevelop and be able to find the size of the buffer being used when performing operations upon strings, but never having used KDevelop before, I'm at a complete loss.<br />
<br />
Could anyone be so kind as to give me some direction as how to go about viewing a buffer which is in use? Can it's contents be viewed within a window of the IDE, or would I have to call functions to 'cout' details about the buffer being used?<br />
<br />
I'm at a complete loss about this, so any info is really appreciated.<br />
<br />
Many many thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Carrots</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236439.html</guid>
		</item>
		<item>
			<title>Functions Calling Functions</title>
			<link>http://www.daniweb.com/forums/thread236437.html</link>
			<pubDate>Fri, 06 Nov 2009 01:03:43 GMT</pubDate>
			<description><![CDATA[How can I call a value that was created in 1 function into another function so that it can be used as a variable?  (i.e  how do I implement the values that I found in my distance function, and use them in my radius function...) 
 
  <div class="codeblock"> <div class="spaced"> <div...]]></description>
			<content:encoded><![CDATA[<div>How can I call a value that was created in 1 function into another function so that it can be used as a variable?  (i.e  how do I implement the values that I found in my distance function, and use them in my radius function...)<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
#include &lt;iostream&gt;<br />
#include &lt;cmath&gt;<br />
using namespace std;<br />
<br />
double distance(double center1, double center2, double point1, double point2);<br />
double radius(double distance3);<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double center1, center2, point1, point2, distance3;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter X-Value of Center: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; center1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter Y-Value of Center: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; center2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter X-Value of Point: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; point1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter Y-Value of Point: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; point2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Distance between Points: &quot; &lt;&lt; distance(center1,center2,point1,point2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Radius: &quot; &lt;&lt; radius(distance3);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
<br />
} //End of Main<br />
<br />
double distance(double center1, double center2, double point1, double point2)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double distance1, distance2, distance3;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; distance1 = pow((point1 - center1), 2); <br />
&nbsp; &nbsp; &nbsp; &nbsp; distance2 = pow((point2 - center2), 2);&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; distance3 = pow((distance1 + distance2), 0.5);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return distance3;<br />
}<br />
<br />
double radius(double distance3)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double rad;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; rad = distance3 / 2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return rad;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>PDB1982</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236437.html</guid>
		</item>
		<item>
			<title>Debugging</title>
			<link>http://www.daniweb.com/forums/thread236436.html</link>
			<pubDate>Fri, 06 Nov 2009 01:00:25 GMT</pubDate>
			<description><![CDATA[Hey How do you go about debugging?  like tips and tricks? 
I have been looking at my code (below) for like an hour and cant figure out what i have done wrong..... 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hey How do you go about debugging?  like tips and tricks?<br />
I have been looking at my code (below) for like an hour and cant figure out what i have done wrong.....<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; #include &lt;fstream&gt; // Header File for File Reading<br />
&nbsp; &nbsp; &nbsp; #include &lt;iostream&gt; // Header File for General I/O-put<br />
&nbsp; &nbsp; &nbsp; #include &lt;math.h&gt;<br />
&nbsp; &nbsp; &nbsp; using namespace std; // Use namespacing<br />
&nbsp;<br />
int main()<br />
{<br />
<br />
ifstream in_stream;<br />
ofstream out_stream;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int a(0), b(0), c(0), Lasta(0), Lastb(0), Lastc(0), counter(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; double bsqrd, fourac, root, root1, root2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
in_stream.open(&quot;inputfile.txt&quot;);<br />
while (1)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Lasta=a; Lastb=b; Lastc=c;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in_stream &gt;&gt; a &gt;&gt; b &gt;&gt; c;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a==Lasta &amp;&amp; b==Lastb &amp;&amp; c==Lastc){break;}<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // calculations for quadratic equation<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bsqrd = b*b;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fourac = 4*a*c;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root = sqrt(bsqrd - fourac);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root1 = (-b + root)/4;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root2 = (-b - root)/4;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NumberOfPositiveRoots(root1, root2);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // counting positive roots function<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;the three values for this quadratic are&quot; &lt;&lt; &quot; &quot; &lt;&lt; a &lt;&lt; &quot; &quot; &lt;&lt; b &lt;&lt; &quot; &quot; &lt;&lt;c &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;The value of x1 is: &quot; &lt;&lt; root1 &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;The value of x2 is: &quot; &lt;&lt; root2 &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; counter &lt;&lt; &quot;of the x values are positive.&quot; &lt;&lt; endl; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
<br />
in_stream.close();<br />
<br />
return 0;<br />
}<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; void NumberOfPositiveRoots(double first, double second)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // function for positive roots<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; int counter = 0;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (first &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; counter++;<br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; if (second &gt;= 0)<br />
&nbsp; &nbsp; &nbsp; counter++;<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; return counter;<br />
&nbsp; &nbsp; &nbsp; }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Ponomous</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236436.html</guid>
		</item>
		<item>
			<title>program writen to transfer galons into liters per mile</title>
			<link>http://www.daniweb.com/forums/thread236435.html</link>
			<pubDate>Fri, 06 Nov 2009 00:50:13 GMT</pubDate>
			<description>my program reads om tje number of liters of gasoline per 2 cars and the number of miles traveled by a car and then its supose to output the number of miles per gallon the car delivered. I used .264179 as my conversion of liters to gallons. Everything seems fine but my number returns as a...</description>
			<content:encoded><![CDATA[<div>my program reads om tje number of liters of gasoline per 2 cars and the number of miles traveled by a car and then its supose to output the number of miles per gallon the car delivered. I used .264179 as my conversion of liters to gallons. Everything seems fine but my number returns as a infinitive.<br />
<br />
here's the code<br />
<br />
#include &lt;iostream&gt;<br />
#include &lt;cmath&gt;<br />
using namespace std;<br />
<br />
    double liters;<br />
    double gallons = liters * .264179;<br />
	char ans;<br />
	double find_mpg( double miles, double liters);<br />
<br />
int main()<br />
{<br />
	do	<br />
	{	<br />
		double miles;<br />
		<br />
		cout &lt;&lt; &quot;enter the number of liters used in the first car\n&quot;;<br />
		cin &gt;&gt; liters;<br />
		cout &lt;&lt; &quot;how many miles did you travel in the first car\n&quot;;<br />
		cin &gt;&gt; miles;<br />
		<br />
		double mpg = find_mpg(miles, liters);<br />
		<br />
		cout &lt;&lt; &quot;this is your fuel eficiency: \n&quot;;<br />
		cout &lt;&lt;  mpg &lt;&lt; &quot; Miles per gallon\n&quot;;<br />
	<br />
		<br />
		cout &lt;&lt; &quot;enter the number of liters used in the second car\n&quot;;<br />
		cin &gt;&gt; liters;<br />
		cout &lt;&lt; &quot;how many miles did you travel in the second car\n&quot;;<br />
		cin &gt;&gt; miles;<br />
		<br />
		cout &lt;&lt; &quot;this is your fuel eficiency for second car: \n&quot;;<br />
		cout &lt;&lt;  mpg &lt;&lt; &quot; Miles per gallon\n&quot;;<br />
		cout &lt;&lt; &quot;do you want to calculate again\n?&quot;;<br />
		cout &lt;&lt; &quot;press Y to recalculate and N to stop&quot;;<br />
		cout &lt;&lt; &quot;and then press return: &quot;;<br />
        cin &gt;&gt; ans;<br />
    } while (ans == 'y' || ans == 'Y');<br />
		<br />
	<br />
<br />
}<br />
<br />
<br />
<br />
double find_mpg(double miles, double liters)<br />
{ <br />
	<br />
	<br />
	double ans = miles / gallons;<br />
	return ans;<br />
	<br />
}<br />
<br />
<br />
<br />
<br />
<br />
<br />
Please help me out, I'm guessing my math is wrong somewhere,<br />
thanks for any help.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>trzypak</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236435.html</guid>
		</item>
		<item>
			<title>Triangle.</title>
			<link>http://www.daniweb.com/forums/thread236429.html</link>
			<pubDate>Fri, 06 Nov 2009 00:14:40 GMT</pubDate>
			<description>I have to print a triangle in C++ where the length is double the height and base of the triangle it is to be isosceles 
 
this is my Isosceles code. how do I change the length base and width so that the length is double. We are only allowed to use stuff up to for loops nothing too fancy. Thank you!...</description>
			<content:encoded><![CDATA[<div>I have to print a triangle in C++ where the length is double the height and base of the triangle it is to be isosceles<br />
<br />
this is my Isosceles code. how do I change the length base and width so that the length is double. We are only allowed to use stuff up to for loops nothing too fancy. Thank you!<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;stdio.h&gt;<br />
<br />
int main(void)<br />
{<br />
int i;<br />
<br />
for (i = 0; i &lt; 1; ++i) {<br />
printf(&quot; *\n&quot;<br />
&quot; *\n&quot;<br />
&quot; **\n&quot;<br />
&quot; ***\n&quot;<br />
&quot; ****\n&quot;<br />
&quot; *****\n&quot;<br />
&quot; ******\n&quot;<br />
&quot; *******\n&quot;<br />
&quot; ********\n&quot;<br />
&quot; *********\n&quot;<br />
&quot; **********\n&quot;<br />
<br />
}<br />
return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>jjf3rd77</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236429.html</guid>
		</item>
		<item>
			<title>counting positive values</title>
			<link>http://www.daniweb.com/forums/thread236426.html</link>
			<pubDate>Fri, 06 Nov 2009 00:04:59 GMT</pubDate>
			<description><![CDATA[Hey so my code below works. It finds the roots for values that are in the quadratic equation from a file. 
 
What i want to do is write a function that will count the number of positive roots.  What would be the easiest way to do this? 
 
I was thinking i could add 
  <div class="codeblock"> <div...]]></description>
			<content:encoded><![CDATA[<div>Hey so my code below works. It finds the roots for values that are in the quadratic equation from a file.<br />
<br />
What i want to do is write a function that will count the number of positive roots.  What would be the easiest way to do this?<br />
<br />
I was thinking i could add<br />
 <pre style="margin:20px; line-height:13px"> if (root1 &gt;= 0)<br />
<br />
{<br />
counter++<br />
else if (root2 &gt;= 0)<br />
<br />
counter++<br />
<br />
}</pre><br />
and then that would give me the total positive roots.<br />
<br />
how would i do this in a function though?<br />
<br />
here is the original code.<br />
<br />
 <pre style="margin:20px; line-height:13px">&nbsp; &nbsp; &nbsp; #include &lt;fstream&gt; // Header File for File Reading<br />
&nbsp; &nbsp; &nbsp; #include &lt;iostream&gt; // Header File for General I/O-put<br />
&nbsp; &nbsp; &nbsp; #include &lt;math.h&gt;<br />
&nbsp; &nbsp; &nbsp; using namespace std; // Use namespacing<br />
&nbsp;<br />
int main()<br />
{<br />
<br />
ifstream in_stream;<br />
ofstream out_stream;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int a(0), b(0), c(0), Lasta(0), Lastb(0), Lastc(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; double bsqrd, fourac, root, root1, root2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
in_stream.open(&quot;inputfile.txt&quot;);<br />
while (1)<br />
&nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Lasta=a; Lastb=b; Lastc=c;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; in_stream &gt;&gt; a &gt;&gt; b &gt;&gt; c;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (a==Lasta &amp;&amp; b==Lastb &amp;&amp; c==Lastc){break;}<br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // calculations<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bsqrd = b*b;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fourac = 4*a*c;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root = sqrt(bsqrd - fourac);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root1 = (-b + root)/4;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; root2 = (-b - root)/4;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;the three values for this quadratic are&quot; &lt;&lt; &quot; &quot; &lt;&lt; a &lt;&lt; &quot; &quot; &lt;&lt; b &lt;&lt; &quot; &quot; &lt;&lt;c &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;The value of x1 is: &quot; &lt;&lt; root1 &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;The value of x2 is: &quot; &lt;&lt; root2 &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; }<br />
<br />
<br />
<br />
in_stream.close();<br />
<br />
<br />
return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Ponomous</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236426.html</guid>
		</item>
		<item>
			<title>Class Fails at Runtime</title>
			<link>http://www.daniweb.com/forums/thread236425.html</link>
			<pubDate>Fri, 06 Nov 2009 00:00:20 GMT</pubDate>
			<description><![CDATA[Hey, I've created this class, it compiles OK but when I go to use the class it fails. It comes up with a pop-up saying something like 'Unexpected Error' 
 
'Class' 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>Hey, I've created this class, it compiles OK but when I go to use the class it fails. It comes up with a pop-up saying something like 'Unexpected Error'<br />
<br />
'Class'<br />
 <pre style="margin:20px; line-height:13px">class Person<br />
{<br />
&nbsp;  public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Person(char theName[], float thePay, int theHours, bool Isworker);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char* getName();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float getPay();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int getDepartment();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setName(char theName[]);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setPay(float thePay);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setHours(int theHours);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setSalaried(bool Isworker);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  char* name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  float pay;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  int hours;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  bool worker;<br />
};</pre><br />
'Functions'<br />
 <pre style="margin:20px; line-height:13px">#include &lt;string&gt;<br />
#include &lt;iostream.h&gt;<br />
#include &quot;person.h&quot;<br />
<br />
Person::Person(){}<br />
Person::Person(char theName[], float thePay, int theHours, bool Isworker)<br />
{<br />
&nbsp;  strcpy(name, theName);<br />
&nbsp;  pay = thePay;<br />
&nbsp;  hours = theHours;<br />
&nbsp;  worker = worker;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
}<br />
<br />
char* Person::getName()<br />
{<br />
&nbsp;  return name;<br />
}<br />
<br />
float Person::getPay()<br />
{<br />
&nbsp; &nbsp; &nbsp; <br />
&nbsp;  return pay;&nbsp; &nbsp;  <br />
}<br />
<br />
int Person::getHours()<br />
{<br />
&nbsp;  return hours;&nbsp; &nbsp;  <br />
}<br />
<br />
void Person::setName(char theName[])<br />
{<br />
&nbsp; &nbsp;  strcpy(name, theName);<br />
}<br />
void Person:: setPay(float thePay)<br />
{<br />
&nbsp; &nbsp;  pay = thePayRate;<br />
}<br />
void Person::setHours(int theHours)<br />
{<br />
&nbsp; &nbsp;  hours = theHoursWorked;<br />
}<br />
void Person::setSalaried(bool Isworker)<br />
{<br />
&nbsp;  worker = Isworker;&nbsp; &nbsp; <br />
}</pre><br />
Any ideas? Thanks.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Phil++</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236425.html</guid>
		</item>
		<item>
			<title>Help Translate this Simple? Algorithm</title>
			<link>http://www.daniweb.com/forums/thread236423.html</link>
			<pubDate>Thu, 05 Nov 2009 23:56:57 GMT</pubDate>
			<description><![CDATA[Hello 
 
HELP :( Ok I have an assignment due in 5 days. I have done *everything* except for one function. This function finds the smallests factors of a positive int & it multiplicities, Have I lost you yet, dont worry because I've been lost for a week now with this function :P 
 
*Heres the funny...]]></description>
			<content:encoded><![CDATA[<div>Hello<br />
<br />
HELP :( Ok I have an assignment due in 5 days. I have done <span style="font-weight:bold">everything</span> except for one function. This function finds the smallests factors of a positive int &amp; it multiplicities, Have I lost you yet, dont worry because I've been lost for a week now with this function :P<br />
<br />
<span style="font-weight:bold">Heres the funny part</span>... we are given the algorithm!! But I cannot for the life of me understand it. I have rewritten, written, pulled my hair out for days trying to get this function to work.<br />
<br />
I cannot seem to get this function to work. Can you take a look at my short function below &amp; see where my algorithm is wrong?<br />
<br />
Algorithm we have been supplied with:<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  An outline of the above algorithm would look something like:<br />
<br />
// positive integer I is given<br />
P = 1<br />
while (I &gt; 1)<br />
{<br />
P = P + 1<br />
if I mod P != 0 go back to previous statement<br />
// now P is the smallest prime factor of I<br />
display P<br />
mult = 1<br />
exactly divide I by P as often as is possible,<br />
assigning to I the result of each exact division,<br />
and incrementing mult with each exact division<br />
display mult, end line<br />
}  <hr /> </td> </tr> </table> </div>An example of what the function is meant to do, if you are confused like me:<br />
<div style="margin:20px; margin-top:5px; "> <div class="smallfont" style="margin-bottom:2px">Quote:</div> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <tr> <td class="alt2"> <hr />  - We input a large integer: 25852<br />
- The function void factor will find the factors and multiplicities<br />
- So the answer is... 2*2*23*281 = 25852<br />
<br />
    <span style="font-style:italic">Please enter a big integer I: 25852<br />
    The number entered was 25852.<br />
    The prime factors of I are:<br />
    2 with multiplicity 2<br />
    23 with multiplicity 1<br />
    281 with multiplicity 1<br />
    Press any key to continue . . .</span><br />
<br />
- As you can see (2*2)+(23*1)+(281*1) = 25852  <hr /> </td> </tr> </table> </div>My code which doesn't work:<br />
 <pre style="margin:20px; line-height:13px">void factor(int I) {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; int P = 1;<br />
&nbsp; &nbsp; int mult;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; while (I &gt; 1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; P = P+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; I = I/P;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (I%P != 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  P = P+1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  I = I/P;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; P &lt;&lt; &quot; with multiplicity &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mult = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (I%P == 0) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  I = I/P;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  mult++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; mult &lt;&lt; endl;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
}</pre><br />
This is one of the functions I have written, if you want to see others that I have written to try to get this algorithm to work then I post them but I dont want this post any longer right now</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>gretty</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236423.html</guid>
		</item>
		<item>
			<title>Host intrusion detection system- help required</title>
			<link>http://www.daniweb.com/forums/thread236422.html</link>
			<pubDate>Thu, 05 Nov 2009 23:53:27 GMT</pubDate>
			<description>Hi guys, wanting to write my own system which (for Windows XP) will monitor packets entering ports and scan them against known virus signatures. Also wanting to constantly check the registry and certain file directories (such as Windows folder) for changes to files which may suggest an attack- then...</description>
			<content:encoded><![CDATA[<div>Hi guys, wanting to write my own system which (for Windows XP) will monitor packets entering ports and scan them against known virus signatures. Also wanting to constantly check the registry and certain file directories (such as Windows folder) for changes to files which may suggest an attack- then an automated order to do something (close ports, back up data etc) will occur.<br />
<br />
Im a Java programmer (not an expert) and havent done too much on C++, however ive been advised i should use C++ for this to use the WIN32API. <br />
<br />
I was wondering if anyone could give me some pointers for this please?<br />
<br />
Thanks in advance, help very much appreciated</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>futureaussiecto</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236422.html</guid>
		</item>
		<item>
			<title>Locking software till they fill out a webpage form?</title>
			<link>http://www.daniweb.com/forums/thread236421.html</link>
			<pubDate>Thu, 05 Nov 2009 23:50:29 GMT</pubDate>
			<description><![CDATA[Is it possible to have software lock itself till the user completes a form on a web page? 
 
The user installs the software, then a splash screen pops up and their web browser opens to a predefined page. 
 
The page is a form that needs completing. Say the form is on "/page1.html", When the user...]]></description>
			<content:encoded><![CDATA[<div>Is it possible to have software lock itself till the user completes a form on a web page?<br />
<br />
The user installs the software, then a splash screen pops up and their web browser opens to a predefined page.<br />
<br />
The page is a form that needs completing. Say the form is on &quot;/page1.html&quot;, When the user completes the form and ends up on a page containing &quot;page2&quot; in the URL, then the software unlocks itself.<br />
<br />
Any ideas? Thank you :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>rupertbeard</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236421.html</guid>
		</item>
		<item>
			<title>Converting between 2d Vector to 2d Array and Vice-Versa</title>
			<link>http://www.daniweb.com/forums/thread236417.html</link>
			<pubDate>Thu, 05 Nov 2009 23:36:14 GMT</pubDate>
			<description>Hello: 
 
If I have a 2d Vector and I want to convert it to a 2d Array what would be the best way to accomplish that.  I know that I can go through a for loop to do it element by element but I would prefer to use the copy command... any suggestions...Lets say the array or vector is 8X10... 
 
...</description>
			<content:encoded><![CDATA[<div>Hello:<br />
<br />
If I have a 2d Vector and I want to convert it to a 2d Array what would be the best way to accomplish that.  I know that I can go through a for loop to do it element by element but I would prefer to use the copy command... any suggestions...Lets say the array or vector is 8X10...<br />
<br />
<br />
Thanks</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>ENCHTERP</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236417.html</guid>
		</item>
		<item>
			<title>C++ need help!!! class with functions</title>
			<link>http://www.daniweb.com/forums/thread236394.html</link>
			<pubDate>Thu, 05 Nov 2009 22:00:51 GMT</pubDate>
			<description><![CDATA[<div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code Tags</a> </div> <div> <strong>C++ Syntax</strong> (<a...]]></description>
			<content:encoded><![CDATA[<div> <pre style="margin:20px; line-height:13px"><br />
#endif<br />
class BankAccount<br />
{<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; double enterAccountData();<br />
&nbsp; &nbsp; &nbsp; &nbsp; double computeInterest();<br />
&nbsp; &nbsp; &nbsp; &nbsp; void displayAccount();<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; int accountNumber;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double accountBalance;<br />
&nbsp; &nbsp; &nbsp; &nbsp; static const double RATE;<br />
}<br />
<br />
<br />
#include &quot;stdafx.h&quot;<br />
<br />
<br />
<br />
#include &lt;stdlib.h&gt;<br />
<br />
#include &lt;conio.h&gt;<br />
<br />
<br />
#include &lt;stdio.h&gt;<br />
<br />
#include &lt;dos.h&gt;<br />
<br />
#include &lt;ctype.h&gt;<br />
<br />
<br />
#include&lt;iostream&gt;// holds the cin and cout commands<br />
<br />
#include&lt;conio.h&gt;// holds the getche() instruction<br />
using namespace std;<br />
//#include &quot;BankAccount.h&quot;<br />
<br />
double RATE = .03;<br />
double BankAccount::enterAccountData()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double balance;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Enter the account number&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(number&lt;0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Account number can not be negative.&quot;&lt;&lt;endl&lt;&lt;&quot;Enter account number.&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(number&lt;1000){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Account number can not be less than 1000.&quot;&lt;&lt;endl&lt;&lt;&quot;Enter account number.&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;number;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Enter the account balance&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;balance;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(balance&lt;0){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Account balance can not be negative.&quot;&lt;&lt;endl&lt;&lt;&quot;Enter account balance.&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;balance;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
double BankAccount::computeInterest()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double years;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double balanceYear, balance1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;number&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; balance1=balance;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i=1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(i&lt;=years){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; balanceYear=balance1+(balance1*RATE);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Year &quot;&lt;&lt;i&lt;&lt;&quot;: the balance is &quot;&lt;&lt;balanceYear&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; balance1=balanceYear;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
void BankAccount::displayAccount()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;The bank account number is &quot;&lt;&lt;number&lt;&lt;&quot;.&quot;&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;The bank account balance is &quot;&lt;&lt;balance&lt;&lt;&quot;.&quot;&lt;&lt;endl;<br />
}<br />
<br />
<br />
int main ()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; BankAccount A;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; A.enterAccountData();&nbsp; &nbsp; <br />
&nbsp; &nbsp; A.computeInterest();&nbsp; &nbsp; <br />
&nbsp; &nbsp; A.displayAccount();<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}<br />
<br />
<br />
<br />
&nbsp; &nbsp; //&nbsp; getche();&nbsp; // necessary to hold the output for the user to read<br />
//}</pre><br />
<br />
<br />
<br />
<br />
It wont compile. i dont think the implementation is correct, any suggestions?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>simplyscottif</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236394.html</guid>
		</item>
		<item>
			<title>Having trouble with deleting suffixes and need help</title>
			<link>http://www.daniweb.com/forums/thread236384.html</link>
			<pubDate>Thu, 05 Nov 2009 21:18:15 GMT</pubDate>
			<description><![CDATA[i need help with removing "s" and "tion" properly if i want to input "composition" it should leave me with "composi" but it leaves me with "compo" and if i were to enter a word that starts with an s and doesnt end with an s the word would not be shown. on the other hand if i were to start and end a...]]></description>
			<content:encoded><![CDATA[<div>i need help with removing &quot;s&quot; and &quot;tion&quot; properly if i want to input &quot;composition&quot; it should leave me with &quot;composi&quot; but it leaves me with &quot;compo&quot; and if i were to enter a word that starts with an s and doesnt end with an s the word would not be shown. on the other hand if i were to start and end a word with s the s at the end would be deleted like it should. help if you can<br />
[CODE]<br />
<br />
<br />
int main()<br />
{<br />
   cout&lt;&lt;&quot;Enter a series of strings.\n&quot;;<br />
   int end,end2,end3,end4;<br />
   <br />
   string input;<br />
<br />
   while(cin&gt;&gt;input)<br />
   {<br />
	 <br />
	   end=input.rfind(&quot;ing&quot;);<br />
	   if(end&gt;-1)<br />
	   {<br />
		   input=input.substr(0,end);<br />
		  // cout&lt;&lt;input&lt;&lt;&quot;\n&quot;;<br />
	   }<br />
	   end2=input.rfind(&quot;ed&quot;);<br />
	  if  (end2&gt;-1)<br />
	   {<br />
		   input=input.substr(0,end2);<br />
		  // cout&lt;&lt;input&lt;&lt;&quot;\n&quot;;<br />
	   }<br />
	   end3=input.rfind(&quot;s&quot;);<br />
	if   (end3&gt;-1)<br />
	   {<br />
             <br />
		   input=input.substr(0,end3);<br />
		   //cout&lt;&lt;input&lt;&lt;&quot;\n&quot;;<br />
	   }<br />
    <br />
end4=input.rfind(&quot;tion&quot;);<br />
//string last_pos=end4.rfind(&quot;s&quot;);<br />
	  if(end4&gt;=-1)<br />
	  {<br />
            <br />
          input=input.substr(0,end4);<br />
			 // cout&lt;&lt;input&lt;&lt;&quot;\n&quot;;<br />
	  }<br />
<br />
	 cout&lt;&lt;input&lt;&lt;&quot;\n&quot;;<br />
   }<br />
 <br />
}<br />
[CODE]</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>reese27</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236384.html</guid>
		</item>
		<item>
			<title>Removing stl features from a program</title>
			<link>http://www.daniweb.com/forums/thread236383.html</link>
			<pubDate>Thu, 05 Nov 2009 21:15:48 GMT</pubDate>
			<description><![CDATA[Hi guys, anyone familiar with the Markov Chain Algorithm? I've got an assignment to take the code from a C++ implementation and remove any stl features like deques and maps, but continue to use strings as my main object type. I've based my changes around a C version of the code, which really just...]]></description>
			<content:encoded><![CDATA[<div>Hi guys, anyone familiar with the Markov Chain Algorithm? I've got an assignment to take the code from a C++ implementation and remove any stl features like deques and maps, but continue to use strings as my main object type. I've based my changes around a C version of the code, which really just needs to be adapted to use C++ strings instead of C char arrays.<br />
<br />
The place I'm running into trouble is trying to initialize all my strings with the &quot;non-word&quot; value  <pre style="margin:20px; line-height:13px">&quot;\n&quot;</pre>. Here's the relevant code:<br />
<br />
 <pre style="margin:20px; line-height:13px">...<br />
const char NONWORD[] = &quot;\n&quot;;<br />
...<br />
int main(void)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i, nwords = MAXGEN;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string *prefix[NPREF];&nbsp; &nbsp; &nbsp; &nbsp; // current input prefix<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; srand(time(NULL));<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; NPREF; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hashadd(prefix, NONWORD);<br />
&nbsp; &nbsp; &nbsp; &nbsp; hashbuild(prefix, cin);<br />
&nbsp; &nbsp; &nbsp; &nbsp; hashadd(prefix, NONWORD);<br />
&nbsp; &nbsp; &nbsp; &nbsp; hashgenerate(nwords);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}<br />
...<br />
void hashadd(string *prefix[NPREF], string *suffix)<br />
{<br />
&nbsp; &nbsp; State *sp;<br />
&nbsp; &nbsp; sp = lookup(prefix, 1);<br />
&nbsp; &nbsp; addsuffix(sp, suffix);<br />
&nbsp; &nbsp; memmove(prefix, prefix+1, (NPREF-1)*sizeof(prefix[0]));<br />
&nbsp; &nbsp; prefix[NPREF - 1] = suffix;<br />
}</pre>The error I get when I go to compile the code is <br />
&quot;prob3.cpp:104: error: invalid conversion from `const char' to `std::string*'&quot;<br />
pointing to the body of the for loop in main intended to put &quot;\n&quot; in each field of prefix. I've tried replacing all references to NONWORD with  <pre style="margin:20px; line-height:13px">&quot;\n&quot;</pre> but I get the same error. Does anyone have a tip to caste or convert newline as a string?<br />
<br />
I have a feeling this is just one of several little hurdles, so if anyone wants to see more of my code to try and find a way around this problem, let me know.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>jmoran19</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236383.html</guid>
		</item>
		<item>
			<title>coding help, reverse array, check for palindrome</title>
			<link>http://www.daniweb.com/forums/thread236381.html</link>
			<pubDate>Thu, 05 Nov 2009 21:10:07 GMT</pubDate>
			<description><![CDATA[Hey guys, I'm having a bit of trouble with an assignment that has been racking my brain. I'm taking a number from the user, using a function to print its reverse order, checking to see if it is a palindrome in the main program and also removing any leading zero's from the results. I'm having no...]]></description>
			<content:encoded><![CDATA[<div>Hey guys, I'm having a bit of trouble with an assignment that has been racking my brain. I'm taking a number from the user, using a function to print its reverse order, checking to see if it is a palindrome in the main program and also removing any leading zero's from the results. I'm having no trouble printing the reverse order but the palindrome check and leading zero removal are driving my crazy. I tried using a loop to check each digit for palindromes but this doesn't seem very effective and returns a reply for each digit for a single statement. Here is the code:<br />
<br />
#include&lt;iostream&gt;<br />
using namespace std;<br />
<br />
int reverse(int bef[], int &amp;tot)<br />
{<br />
int i,j,t;<br />
<br />
for(i=0, j=tot-1; i&lt;j; i++, j--)<br />
{t=bef[i]; bef[i]=bef[j]; bef[j]=t;}<br />
<br />
<br />
<br />
}<br />
<br />
int main()<br />
{<br />
<br />
<br />
int i;<br />
int totdig;<br />
cout &lt;&lt; &quot;Enter total number of digits in the number you would like reversed: &quot;;<br />
cin &gt;&gt; totdig;<br />
int before[totdig];<br />
int orig[totdig];<br />
cout &lt;&lt; &quot;\nEnter the complete number, seperate each digit with a space: &quot;;<br />
for(i=0;i&lt;totdig;i++) cin &gt;&gt; before[i];<br />
for(i=0;i&lt;totdig;i++) orig[i]=before[i];<br />
reverse(before, totdig);<br />
<br />
<br />
<br />
<br />
for(i=0;i&lt;totdig;i++) cout &lt;&lt; orig[i];<br />
cout &lt;&lt; endl;<br />
for(i=0;i&lt;totdig;i++) cout &lt;&lt; before[i];<br />
cout &lt;&lt; endl;<br />
<br />
<br />
<br />
return 0;<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>dmitriylm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236381.html</guid>
		</item>
		<item>
			<title>stdlib not found</title>
			<link>http://www.daniweb.com/forums/thread236377.html</link>
			<pubDate>Thu, 05 Nov 2009 20:52:25 GMT</pubDate>
			<description><![CDATA[Hi, 
This is small c++ guess game, I almost finished it, but when i tried compile it gave me an error: "Cannot open include file: 'stdlib': No such file or directory" 
is this file part of c++ standard library..? why compiler can't find it? 
 
here is my .cpp source:]]></description>
			<content:encoded><![CDATA[<div>Hi,<br />
This is small c++ guess game, I almost finished it, but when i tried compile it gave me an error: &quot;Cannot open include file: 'stdlib': No such file or directory&quot;<br />
is this file part of c++ standard library..? why compiler can't find it?<br />
<br />
here is my .cpp source:</div>  <br /> <div style="padding:5px">     <fieldset class="fieldset"> <legend>Attached Files</legend> <table cellpadding="0" cellspacing="5" border="0"> <tr> <td><img class="inlineimg" src="http://www.daniweb.com/forums/images/attach/cpp.gif" alt="File Type: cpp" width="16" height="16" border="0" style="vertical-align:baseline" /></td> <td><a href="http://www.daniweb.com/forums/attachment.php?attachmentid=12456&amp;d=1257454023">main.cpp</a> (1.9 KB)</td> </tr> </table> </fieldset>  </div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>iammfa</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236377.html</guid>
		</item>
		<item>
			<title>help with an exercise</title>
			<link>http://www.daniweb.com/forums/thread236374.html</link>
			<pubDate>Thu, 05 Nov 2009 20:46:03 GMT</pubDate>
			<description>A criticism of the break and continue statements is that each is unstructured. Actually they statements can always be replaced by structured statements, although doing so can be awkward. Describe in general how you would remove any break statement from a loop in a program and replace it with some...</description>
			<content:encoded><![CDATA[<div>A criticism of the break and continue statements is that each is unstructured. Actually they statements can always be replaced by structured statements, although doing so can be awkward. Describe in general how you would remove any break statement from a loop in a program and replace it with some structured equivalent. [Hint: The break statement leaves a loop from within the body of the loop. Another way to leave is by failing the loop-continuation test. Consider using in the loop-continuation test a second test that indicates &quot;early exit because of a 'break' condition.&quot;]</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>alexa868</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236374.html</guid>
		</item>
		<item>
			<title>Array separation</title>
			<link>http://www.daniweb.com/forums/thread236371.html</link>
			<pubDate>Thu, 05 Nov 2009 20:39:29 GMT</pubDate>
			<description>Problem solved, feel free to delete.</description>
			<content:encoded><![CDATA[<div>Problem solved, feel free to delete.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>dmitriylm</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236371.html</guid>
		</item>
		<item>
			<title>Input file to project</title>
			<link>http://www.daniweb.com/forums/thread236368.html</link>
			<pubDate>Thu, 05 Nov 2009 20:31:45 GMT</pubDate>
			<description><![CDATA[For the final part of our project, we're supposed to: 
 
Add the following constant (the file name must match exactly): 
const string MASTER_FILE_NAME = "master.txt"; 
 
 
2.	Create the file master.txt and add it to your project. 
The master file must contain account records (one record per line)....]]></description>
			<content:encoded><![CDATA[<div>For the final part of our project, we're supposed to:<br />
<br />
Add the following constant (the file name must match exactly):<br />
const string MASTER_FILE_NAME = &quot;master.txt&quot;;<br />
<br />
<br />
2.	Create the file master.txt and add it to your project.<br />
The master file must contain account records (one record per line).<br />
Each account record contains the following fields, separated by spaces:<br />
1.	Account number, alphanumeric<br />
2.	First Name, string<br />
3.	Last Name, string<br />
4.	Account Balance, double<br />
For example,<br />
<br />
A111 Jayson Haxton 12345.81<br />
A567 Amanda Noel 100893.77<br />
B444 Thomas Huson 1.99<br />
C565 Jonathan Odaniel -5.00<br />
C890 Jeffrey Krabbe 500000.00<br />
<br />
The BalanceFromFileFunction will read the master file and find the balance for given account. <br />
<br />
How do I go about doing this? I created a text file with the example information in it, but how do I import this into the project?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>sfurlow</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236368.html</guid>
		</item>
		<item>
			<title>Input time as hh:mm and no other way</title>
			<link>http://www.daniweb.com/forums/thread236364.html</link>
			<pubDate>Thu, 05 Nov 2009 20:12:09 GMT</pubDate>
			<description><![CDATA[So my program is coming along, but now I am writing in the range checking to ensure that the inputs are actually what they should be. My code works fine for time, except for the fact that white space gets ignored. I need to ensure that a user cannot input "10:   09 AM". It must be in the format...]]></description>
			<content:encoded><![CDATA[<div>So my program is coming along, but now I am writing in the range checking to ensure that the inputs are actually what they should be. My code works fine for time, except for the fact that white space gets ignored. I need to ensure that a user cannot input &quot;10:   09 AM&quot;. It must be in the format hh:mm<br />
<br />
My code:<br />
<br />
 <pre style="margin:20px; line-height:13px">void Time::makeAppt()<br />
{<br />
&nbsp; Time startTime, endTime;<br />
<br />
&nbsp; cout &lt;&lt; &quot;Start time &gt;&gt;&quot;;<br />
&nbsp; cin &gt;&gt; startTime;<br />
&nbsp; cout &lt;&lt; &quot;End time &gt;&gt; &quot;;<br />
&nbsp; cin &gt;&gt; endTime;<br />
}<br />
<br />
istream &amp;operator&gt;&gt;( istream &amp;input, Time &amp;time)<br />
{<br />
&nbsp; input &gt;&gt; time.hour;<br />
&nbsp; input.ignore();<br />
&nbsp; input &gt;&gt; time.minute;<br />
&nbsp; input.ignore();<br />
&nbsp; input &gt;&gt; time.period;<br />
<br />
&nbsp; return input;<br />
}</pre>Thank you for any suggestions you might have. =]</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>dotnabox</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236364.html</guid>
		</item>
		<item>
			<title><![CDATA[(IDE) [VC++ 6.0] Dialog Control [Not MFC]]]></title>
			<link>http://www.daniweb.com/forums/thread236300.html</link>
			<pubDate>Thu, 05 Nov 2009 15:18:45 GMT</pubDate>
			<description>Hi guys, I am just wondering how to implement a dialog I have made in Microsoft C++ 6.0 
 
So I created a C++ project, then added a .rc script file. Then I added a new item to it (dialog control, called IDD_MENU) Now, I am wondering how would I use this menu inside my code? I have worked with...</description>
			<content:encoded><![CDATA[<div>Hi guys, I am just wondering how to implement a dialog I have made in Microsoft C++ 6.0<br />
<br />
So I created a C++ project, then added a .rc script file. Then I added a new item to it (dialog control, called IDD_MENU) Now, I am wondering how would I use this menu inside my code? I have worked with WINAPI and spent hours coding GUIS. Just yesterday I downloaded C++ 6.0 (my new compiler, instead of Code::Blocks.  Could save me hours of time!) and I am wondering how would I use the GUI I created? I have tried implementing it the same way I usually do for WINAPI, but this did not work. How do I do this? I have searched google for 1 day now, and I have not found anything. Hopefully somebody could help me out on this.<br />
<br />
Thanks,<br />
Chris</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>scriptkiddy</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236300.html</guid>
		</item>
		<item>
			<title>(Beginner) how to return char variable?</title>
			<link>http://www.daniweb.com/forums/thread236294.html</link>
			<pubDate>Thu, 05 Nov 2009 14:55:25 GMT</pubDate>
			<description><![CDATA[how to get string from other function? 
i tried this , but come error... 
i using Visual Basic C++.... 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox"...]]></description>
			<content:encoded><![CDATA[<div>how to get string from other function?<br />
i tried this , but come error...<br />
i using Visual Basic C++....<br />
 <pre style="margin:20px; line-height:13px">void main()<br />
{<br />
&nbsp;  char name[51];<br />
&nbsp;  name=NAME();<br />
}<br />
<br />
int NAME()<br />
{<br />
&nbsp;  char names[51];<br />
&nbsp;  names=&quot;john&quot;;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>rino699</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236294.html</guid>
		</item>
		<item>
			<title>Implemeting C++ methods</title>
			<link>http://www.daniweb.com/forums/thread236286.html</link>
			<pubDate>Thu, 05 Nov 2009 14:15:44 GMT</pubDate>
			<description>I would like to implement a method to add,delete an item on a order list, and print the order total for an order. The attributes are part_number,part_name,part_price. Please give me an idea of how it is done</description>
			<content:encoded><![CDATA[<div>I would like to implement a method to add,delete an item on a order list, and print the order total for an order. The attributes are part_number,part_name,part_price. Please give me an idea of how it is done</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>antonywere</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236286.html</guid>
		</item>
		<item>
			<title>what is the path to move to every point of a matrix of 5 column and 5 row once?????</title>
			<link>http://www.daniweb.com/forums/thread236250.html</link>
			<pubDate>Thu, 05 Nov 2009 12:16:38 GMT</pubDate>
			<description>can somebody help me with this program?? 
i have to program a matrix with n column and n row and it should be able to find a path moving like a knight in chess game(L) that touch every point of the matrix once. the program consist in enter the location where i want to start (n,n) n=1,2,3,4,5 and...</description>
			<content:encoded><![CDATA[<div>can somebody help me with this program??<br />
i have to program a matrix with n column and n row and it should be able to find a path moving like a knight in chess game(L) that touch every point of the matrix once. the program consist in enter the location where i want to start (n,n) n=1,2,3,4,5 and the computer will calculate the path...<br />
ex: starting from (1,1) we have:<br />
1 6 15 10 21<br />
14 9 20 5 16<br />
19 2 7 22 11<br />
8 13 24 17 4<br />
25 18 3 12 23<br />
you can see that the sequence of the numbers is in L. i need at least a start head</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>nick30266</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236250.html</guid>
		</item>
		<item>
			<title>what is the path to move to every point of a matrix of 5 column and 5 row once?????</title>
			<link>http://www.daniweb.com/forums/thread236247.html</link>
			<pubDate>Thu, 05 Nov 2009 11:54:52 GMT</pubDate>
			<description>can somebody help me with this program?? 
i have to program a matrix with n column and n row and it should be able to find a path moving like a horse in chess game(L) that touch every point of the matrix once. the program consist in enter the location where i want to start (n,n) n=1,2,3,4,5 and the...</description>
			<content:encoded><![CDATA[<div>can somebody help me with this program??<br />
i have to program a matrix with n column and n row and it should be able to find a path moving like a horse in chess game(L) that touch every point of the matrix once. the program consist in enter the location where i want to start (n,n) n=1,2,3,4,5 and the computer will calculate the path...<br />
ex: starting from (1,1) we have:<br />
1 6 15 10 21<br />
14 9 20 5 16<br />
19 2 7 22 11<br />
8 13 24 17 4<br />
25 18 3 12 23<br />
you can see that the sequence of the numbers is in L. i need at least a start head</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>nick30266</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236247.html</guid>
		</item>
		<item>
			<title>About matris allocation and reading pgm files</title>
			<link>http://www.daniweb.com/forums/thread236246.html</link>
			<pubDate>Thu, 05 Nov 2009 11:53:49 GMT</pubDate>
			<description><![CDATA[// Tuba.cpp : Defines the entry point for the console application. 
// 
 
#include "stdafx.h" 
#include <stdlib.h> 
 
 
 
unsigned char** pgmRead(char *fileName) 
{]]></description>
			<content:encoded><![CDATA[<div>// Tuba.cpp : Defines the entry point for the console application.<br />
//<br />
<br />
#include &quot;stdafx.h&quot;<br />
#include &lt;stdlib.h&gt;<br />
<br />
<br />
<br />
unsigned char** pgmRead(char *fileName)<br />
{<br />
	unsigned char **pixel;<br />
	int versiyon;<br />
	int yukseklik;<br />
	int genislik;<br />
	int griSeviyesi;<br />
	char yorum[256];<br />
<br />
	int head[3];<br />
	char c1,c2;<br />
	char ch;<br />
	unsigned char *block;<br />
<br />
	int i,j;<br />
	<br />
	FILE *inf;<br />
	inf = fopen(fileName, &quot;rb&quot;);<br />
	if (inf == NULL) <br />
	{<br />
		printf(&quot;Dosya yok!n&quot;);<br />
		exit(1);<br />
	}<br />
	else <br />
	{<br />
		fscanf(inf, &quot;%c%c&quot;, &amp;c1, &amp;c2);<br />
		printf(&quot;%c %c&quot;,c1,c2);<br />
		if (c1 != 'P' || (c2 != '2' &amp;&amp; c2 != '5')) <br />
		{<br />
			printf(&quot;PGM formatı desteklemeyen dosya!n&quot;);<br />
			fclose(inf);<br />
			exit(1);<br />
		}<br />
	}<br />
<br />
	for (j=0; j&lt;3; j++) {<br />
		do {<br />
			i=0;<br />
			ch = fgetc(inf);<br />
			if (ch == '#') <br />
			do {<br />
				yorum[i++]=fgetc(inf);<br />
			} while (yorum[i-1]!= 'n');<br />
			yorum[i]=0;<br />
		//   printf(&quot;COMMENT: %s&quot;,str); //*** if wished comments can be printed out here<br />
		} while(ch &lt; '0' || ch &gt; '9');<br />
<br />
		i = 0;<br />
		yorum[i++] = ch;<br />
		do {<br />
			ch = fgetc(inf);<br />
			yorum[i++] = ch;<br />
		} while(ch &gt;= '0' &amp;&amp; ch &lt;= '9');<br />
		yorum[i-1] = 0;<br />
		head[j] = atoi(yorum);<br />
		i=0;<br />
	}<br />
<br />
	versiyon= c2-'0';<br />
	genislik= head[0];<br />
    yukseklik=head[1];<br />
	griSeviyesi=head[2];<br />
<br />
<br />
	//____________hata bunun altında bi yerlerde<br />
	pixel=(unsigned char **)calloc(genislik,sizeof(unsigned char));<br />
	for(i=0;i&lt;genislik;i++)<br />
	{<br />
	  pixel[i]=(unsigned char*)calloc(yukseklik,sizeof(unsigned char));<br />
	}<br />
	block=(unsigned char*)calloc(genislik,sizeof(unsigned char));<br />
<br />
	for(i=0;i&lt;genislik;i++){<br />
		for(j=0;yukseklik;j++){<br />
			fread((void *)block,sizeof(unsigned char),genislik*yukseklik,inf);<br />
			pixel[i][j]=(unsigned char)block[(j*genislik)+i];<br />
		}<br />
	}<br />
	free(block);<br />
	fclose(inf);<br />
<br />
	return (pixel);<br />
}<br />
<br />
<br />
//int _tmain(int argc, _TCHAR* argv[])<br />
int main()<br />
{<br />
	char dosyaIsmi[15];<br />
	printf(&quot;Cevirilecek dosyayı giriniz.\n&quot;);<br />
	scanf(&quot;%s&quot;,&amp;dosyaIsmi);<br />
	<br />
	pgmRead(dosyaIsmi);<br />
<br />
	return 0;<br />
}<br />
<br />
<br />
<br />
<br />
<br />
This code is fail cause of memory allocaiton;but I don't understand why.<br />
<br />
How can I correct it?</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>firtina</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236246.html</guid>
		</item>
		<item>
			<title>My code is giving lots of errors</title>
			<link>http://www.daniweb.com/forums/thread236244.html</link>
			<pubDate>Thu, 05 Nov 2009 11:43:08 GMT</pubDate>
			<description>Pls help me out i am using visual C++6.0 enterprise edition.... 
 
 
/*--------------------------------------------------------------------------*/ 
/*--------------------------------------------------------------------------*/ 
//  Source file originally created by PegWindowBuilder 
//   
//   
//...</description>
			<content:encoded><![CDATA[<div>Pls help me out i am using visual C++6.0 enterprise edition....<br />
<br />
 <pre style="margin:20px; line-height:13px">/*--------------------------------------------------------------------------*/<br />
/*--------------------------------------------------------------------------*/<br />
//&nbsp; Source file originally created by PegWindowBuilder<br />
//&nbsp; <br />
//&nbsp; <br />
//&nbsp; Class Name: ecgclass<br />
//&nbsp; <br />
//&nbsp; Notes:<br />
/*--------------------------------------------------------------------------*/<br />
/*--------------------------------------------------------------------------*/<br />
<br />
<br />
<br />
/* WB Auto-Generated Start (1)&nbsp; */<br />
#include &quot;peg.hpp&quot;<br />
#include &quot;ecg_res.hpp&quot;<br />
#include &quot;ecgone.hpp&quot;<br />
extern PegResourceTable Default_Theme_ResourceTable;<br />
/* WB Auto-Generated End (2)&nbsp; */<br />
<br />
/*--------------------------------------------------------------------------*/<br />
/*--------------------------------------------------------------------------*/<br />
/* WB Auto-Generated Start (3)&nbsp; */<br />
void PegAppInitialize(PegPresentationManager *pPresent)<br />
{<br />
&nbsp; &nbsp; /* WB Auto-Generated End (20)&nbsp; */<br />
<br />
&nbsp; &nbsp; /* WB Auto-Generated Start (21)&nbsp; */<br />
&nbsp; &nbsp; PegResourceManager::InstallResourcesFromTable(&amp;Default_Theme_ResourceTable);<br />
&nbsp; &nbsp; ecgclass *pWin = new ecgclass(0,0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ecgclass ;<br />
&nbsp; &nbsp; pPresent-&gt;Center(pWin);<br />
&nbsp; &nbsp; pPresent-&gt;Add(pWin);<br />
&nbsp; &nbsp; /* WB Auto-Generated End (4)&nbsp; */<br />
<br />
}<br />
<br />
/* WB Auto-Generated Start (5)&nbsp; */<br />
/*--------------------------------------------------------------------------*/<br />
/*--------------------------------------------------------------------------*/<br />
//&nbsp; Constructor<br />
//&nbsp; Create top level object and add all children<br />
/*--------------------------------------------------------------------------*/<br />
/*--------------------------------------------------------------------------*/<br />
ecgclass::ecgclass(PEGINT Left, PEGINT Top) : <br />
&nbsp; &nbsp; PegWindow(FF_THIN)<br />
{<br />
&nbsp; &nbsp; PegRect ChildRect;<br />
&nbsp; &nbsp; PegThing *pChild1, *pChild2;<br />
<br />
&nbsp; &nbsp; /* WB Auto-Generated End (6)&nbsp; */<br />
<br />
&nbsp; &nbsp; /* WB Auto-Generated Start (7)&nbsp; */<br />
&nbsp; &nbsp; mReal.Set(Left, Top, Left + 949, Top + 849);<br />
&nbsp; &nbsp; InitClient();<br />
&nbsp; &nbsp; SetColor(PCI_NORMAL, CID_LOWLIGHT);<br />
&nbsp; &nbsp; RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 71, Left + 935, Top + 248);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_ECG,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 71, Left + 841, Top + 248);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_ELECTRO, 0, FF_RAISED);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTGREEN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 854, Top + 173, Left + 922, Top + 192);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_ECGREADING);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_GREEN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 899, Top + 78, Left + 927, Top + 97);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_UPPER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_GREEN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 905, Top + 150, Left + 933, Top + 169);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_LOWER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_GREEN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 853, Top + 102, Left + 901, Top + 146);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_ECGBOX,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 247, Left + 935, Top + 344);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_SPO2,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 247, Left + 838, Top + 344);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_OXYGEN, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_MENUBAR_HOV);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 843, Top + 318, Left + 927, Top + 337);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_SPOREADING);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTCYAN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 905, Top + 249, Left + 933, Top + 268);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_SPOUPPER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTCYAN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 905, Top + 298, Left + 933, Top + 317);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_SPOLOWER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTCYAN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 905, Top + 274, Left + 933, Top + 293);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PERCENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTCYAN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 844, Top + 262, Left + 892, Top + 306);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_SPOBOX,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 344, Left + 935, Top + 441);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_CO2,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 344, Left + 835, Top + 441);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_CARBON, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 844, Top + 344, Left + 933, Top + 363);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_CARBONAGENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 838, Top + 377, Left + 931, Top + 396);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_CARBONREADING, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_NONE|AF_TRANSPARENT|TJ_RIGHT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 882, Top + 420, Left + 931, Top + 439);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_CARBONREAD);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 881, Top + 397, Left + 896, Top + 417);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARAONELOW);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 918, Top + 365, Left + 933, Top + 385);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_CARBOREADIN);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 837, Top + 397, Left + 933, Top + 397);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, 0, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 848, Top + 360, Left + 865, Top + 378);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_COBOX, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 896, Top + 360, Left + 913, Top + 378);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_COBOXTWO,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 845, Top + 404, Left + 873, Top + 432);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_COBOXTHRE,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 801, Top + 538, Left + 936, Top + 635);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_P2,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 801, Top + 575, Left + 836, Top + 635);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_ARTS, 0, FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_HELP_PRMPT);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 801, Top + 538, Left + 851, Top + 577);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARAMETERTWO, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 855, Top + 540, Left + 934, Top + 565);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOUPPER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 840, Top + 593, Left + 919, Top + 618);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOREAD);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 855, Top + 608, Left + 934, Top + 633);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOREADIN);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 881, Top + 565, Left + 891, Top + 595);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOSLASH);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 893, Top + 568, Left + 920, Top + 591);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_PTWOTWO,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 850, Top + 566, Left + 877, Top + 589);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_PTWO, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 799, Top + 633, Left + 934, Top + 730);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_GAS,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 799, Top + 633, Left + 834, Top + 730);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_GASEOUS, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_YELLOW);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 845, Top + 643, Left + 873, Top + 662);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_OXYGENPERCENT, 0, FF_NONE|TJ_LEFT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_SHADOW);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_GREEN);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 845, Top + 692, Left + 874, Top + 722);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_NITROGENPERCENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 891, Top + 644, Left + 923, Top + 670);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_GASO, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 892, Top + 693, Left + 922, Top + 719);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_GASNO, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 441, Left + 935, Top + 538);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_P1,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 478, Left + 835, Top + 538);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_ARTS, 0, FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_HELP_PRMPT);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 800, Top + 441, Left + 850, Top + 480);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARAMETERONE, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 854, Top + 442, Left + 933, Top + 467);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOUPPER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 836, Top + 493, Left + 915, Top + 518);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOREAD);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 856, Top + 511, Left + 935, Top + 536);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOREADIN);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 883, Top + 468, Left + 893, Top + 498);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOSLASH);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 851, Top + 468, Left + 878, Top + 491);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_PONE, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 893, Top + 469, Left + 920, Top + 492);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_PONETWO,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 662, Top + 634, Left + 797, Top + 732);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_AGENT,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 662, Top + 635, Left + 697, Top + 732);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_AGENTS, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_HIGHLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 698, Top + 681, Left + 794, Top + 681);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, 0, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 698, Top + 634, Left + 796, Top + 671);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, SID_AGENTONE, 0, FF_NONE|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 698, Top + 689, Left + 796, Top + 726);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, SID_AGENTTWO, 0, FF_NONE|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 527, Top + 634, Left + 664, Top + 732);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_RESP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 527, Top + 635, Left + 562, Top + 732);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_RESPIRATON, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_HIGHLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 642, Top + 636, Left + 660, Top + 662);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_RESPIUP);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 648, Top + 664, Left + 659, Top + 685);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_RESPILOW);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 627, Top + 687, Left + 656, Top + 713);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_RESPIBEAT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 575, Top + 646, Left + 621, Top + 681);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_RESPO, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 389, Top + 634, Left + 529, Top + 732);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_TEMP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 390, Top + 634, Left + 425, Top + 732);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_TEMPERATURE, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_HIGHLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 495, Top + 688, Left + 524, Top + 714);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_TEMPDEGREE);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 431, Top + 636, Left + 460, Top + 662);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_TEMPE);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 494, Top + 634, Left + 523, Top + 660);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_TEMPUPPER);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 495, Top + 658, Left + 524, Top + 684);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_TEMPLOW);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 436, Top + 674, Left + 482, Top + 709);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_TEMPO, FF_RECESSED|TT_COPY|EF_WRAP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  1000);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 0, Top + 634, Left + 301, Top + 732);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, 0, ID_MANUALBOX,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT|TJ_LEFT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ChildRect.Set(Left + 45, Top + 644, Left + 117, Top + 671);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, SID_MANUALLLY, ID_MANUAL,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_NONE|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;AddStatus(PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_MAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 0, Top + 634, Left + 35, Top + 732);<br />
&nbsp; &nbsp; pChild2 = new PegVPrompt(ChildRect, SID_BLOODPRESSURE, 0,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RAISED|AF_TRANSPARENT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_BLACK);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTMAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 167, Top + 680, Left + 246, Top + 705);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOREAD);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTMAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 185, Top + 700, Left + 264, Top + 725);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOREADIN);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTMAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 46, Top + 673, Left + 71, Top + 698);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_NIBPET);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTMAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 121, Top + 668, Left + 146, Top + 693);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_NIBPTWO);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTMAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 138, Top + 644, Left + 183, Top + 669);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_NIBPREADIN);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_LIGHTMAGENTA);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 205, Top + 647, Left + 235, Top + 674);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_NIBPUP,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 243, Top + 644, Left + 253, Top + 674);<br />
&nbsp; &nbsp; pChild2 = new PegPrompt(ChildRect, SID_PARATWOSLASH);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NORMAL, CID_NORMAL_TEXT);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_WHITE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 256, Top + 647, Left + 286, Top + 674);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, 0, ID_NIBPDOWN,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 42, Top + 698, Left + 108, Top + 722);<br />
&nbsp; &nbsp; pChild2 = new PegTextBox(ChildRect, SID_USAGETIMER, ID_TIMER,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild2-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; pChild2-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; pChild1-&gt;Add(pChild2);<br />
<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 492, Top + 751, Left + 558, Top + 770);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, SID_BATTERYSPO);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_LIGHTCYAN);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 689, Top + 753, Left + 734, Top + 772);<br />
&nbsp; &nbsp; pChild1 = new PegPrompt(ChildRect, SID_BATTERYECG);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_LIGHTGREEN);<br />
&nbsp; &nbsp; Add(pChild1);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; #define PegLineChart<br />
&nbsp; &nbsp; &nbsp; &nbsp; #define ChildRect<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 1, Top + 70, Left + 800, Top + 249);<br />
&nbsp; &nbsp; pChild1 = new PegLineChart(ChildRect, 0, 50, 0, 50, 10, 10);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_GRAPH1);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_LOWLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_DESKTOP);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;SetExStyle (CS_DRAWYTICS|CS_AUTOSIZE|CS_DRAWYLABELS);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;RemoveStyle (FF_MASK);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;AddStyle (FF_NONE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 1, Top + 250, Left + 797, Top + 345);<br />
&nbsp; &nbsp; pChild1 = new PegLineChart(ChildRect, 0, 50, 0, 50, 10, 10);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_GRAPH2);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_LOWLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_DESKTOP);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;SetExStyle(CS_DRAWYTICS|CS_AUTOSIZE|CS_DRAWYLABELS);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;RemoveStyle(FF_MASK);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;AddStyle(FF_NONE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 1, Top + 346, Left + 797, Top + 441);<br />
&nbsp; &nbsp; pChild1 = new PegLineChart(ChildRect, 0, 50, 0, 50, 10, 10);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_GRAPH3);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_LOWLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_DESKTOP);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;SetExStyle(CS_DRAWYTICS|CS_AUTOSIZE|CS_DRAWYLABELS);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;RemoveStyle(FF_MASK);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;AddStyle(FF_NONE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 1, Top + 534, Left + 800, Top + 634);<br />
&nbsp; &nbsp; pChild1 = new PegLineChart(ChildRect, 0, 50, 0, 50, 10, 10);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_GRAPH5);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_DARKGRAY);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_DESKTOP);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;SetExStyle(CS_DRAWYTICS|CS_AUTOSIZE|CS_DRAWYLABELS);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;RemoveStyle(FF_MASK);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;AddStyle(FF_NONE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 1, Top + 439, Left + 797, Top + 534);<br />
&nbsp; &nbsp; pChild1 = new PegLineChart(ChildRect, 0, 50, 0, 50, 10, 10);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_GRAPH4);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_LOWLIGHT);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NTEXT, CID_BLACK);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;SetExStyle(CS_DRAWYTICS|CS_AUTOSIZE|CS_DRAWYLABELS);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;RemoveStyle(FF_MASK);<br />
&nbsp; &nbsp; ((PegLineChart *) pChild1)-&gt;AddStyle(FF_NONE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 442, Top + 774, Left + 589, Top + 802);<br />
&nbsp; &nbsp; pChild1 = new PegProgressBar(ChildRect,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|PS_SHOW_VAL|PS_RECESSED|PS_PERCENT, 0, 100, 0);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_PERCENTSPO);<br />
&nbsp; &nbsp; pChild1-&gt;SetColor(PCI_NORMAL, CID_DARKGRAY);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 638, Top + 774, Left + 786, Top + 802);<br />
&nbsp; &nbsp; pChild1 = new PegProgressBar(ChildRect,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|PS_SHOW_VAL|PS_RECESSED|PS_PERCENT, 0, 100, 0);<br />
&nbsp; &nbsp; pChild1-&gt;SetId(ID_PERCENTECG);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 473, Top + 812, Left + 537, Top + 837);<br />
&nbsp; &nbsp; pChild1 = new PegTextBox(ChildRect, SID_SPOTIMER, ID_TIMERSPO,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild1-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; ChildRect.Set(Left + 665, Top + 813, Left + 733, Top + 836);<br />
&nbsp; &nbsp; pChild1 = new PegTextBox(ChildRect, SID_ECGTIMWER, ID_TIMERECG,<br />
&nbsp; &nbsp; &nbsp; &nbsp;  FF_RECESSED|TT_COPY|EF_WRAP, 1000);<br />
&nbsp; &nbsp; pChild1-&gt;RemoveStatus(PSF_MOVEABLE|PSF_SIZEABLE);<br />
&nbsp; &nbsp; Add(pChild1);<br />
<br />
&nbsp; &nbsp; /* WB Auto-Generated End (8)&nbsp; */<br />
<br />
}<br />
<br />
<br />
/*--------------------------------------------------------------------------*/<br />
/*--------------------------------------------------------------------------*/<br />
/* WB Auto-Generated Start (9)&nbsp; */<br />
PEGINT ecgclass::Message(const PegMessage &amp;Mesg)<br />
{<br />
/* WB Auto-Generated End (10)&nbsp; */<br />
<br />
&nbsp; &nbsp; /* WB Auto-Generated Start (11)&nbsp; */<br />
&nbsp; &nbsp; switch (Mesg.Type)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; /* WB Auto-Generated End (12)&nbsp; */<br />
<br />
&nbsp;  case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; return PegWindow::Message(Mesg);<br />
&nbsp; &nbsp; return 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre><br />
<br />
<br />
<br />
<br />
<br />
<br />
--------------------Configuration: bitmaps - Win32 Debug--------------------<br />
Compiling...<br />
ecgone.cpp<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(555) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(556) : error C2059: syntax error : 'constant'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(560) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(561) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(562) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(565) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(566) : error C2059: syntax error : ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(570) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(571) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(572) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(575) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(576) : error C2059: syntax error : ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(580) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(581) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(582) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(585) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(586) : error C2059: syntax error : ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(590) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(591) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(592) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(595) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(596) : error C2059: syntax error : ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(600) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(601) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(602) : error C2059: syntax error : ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(605) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(606) : error C2143: syntax error : missing ')' before ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(606) : error C2512: 'PegProgressBar' : no appropriate default constructor available<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(607) : error C2143: syntax error : missing ';' before ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(612) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(613) : error C2143: syntax error : missing ')' before ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(613) : error C2512: 'PegProgressBar' : no appropriate default constructor available<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(614) : error C2143: syntax error : missing ';' before ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(618) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(619) : error C2143: syntax error : missing ')' before ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(619) : error C2512: 'PegTextBox' : no appropriate default constructor available<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(620) : error C2143: syntax error : missing ';' before ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(624) : error C2143: syntax error : missing ';' before '.'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(625) : error C2143: syntax error : missing ')' before ','<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(625) : error C2512: 'PegTextBox' : no appropriate default constructor available<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(626) : error C2143: syntax error : missing ';' before ')'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : error C2143: syntax error : missing ';' before '}'<br />
D:\Desktop\examples\kiran\ecg\ecgone.cpp(632) : fatal error C1003: error count exceeds 100; stopping compilation<br />
Error executing cl.exe.<br />
<br />
bitmaps.exe - 102 error(s), 0 warning(s)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>kiranpreddy05</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236244.html</guid>
		</item>
		<item>
			<title>A (*) star algorithm too slow</title>
			<link>http://www.daniweb.com/forums/thread236239.html</link>
			<pubDate>Thu, 05 Nov 2009 11:15:53 GMT</pubDate>
			<description><![CDATA[Hi I am implementing a "Star Craft" game and I have troubles on my A* algorithm. I followed the steps in here (http://www.policyalmanac.org/games/aStarTutorial.htm) and created my own implementation using object oriented c++. Now when I have say 32 x 32 grid, and I need to move 1 unit, it takes for...]]></description>
			<content:encoded><![CDATA[<div>Hi I am implementing a &quot;Star Craft&quot; game and I have troubles on my A* algorithm. I followed the steps in <a rel="nofollow" class="t" href="http://www.policyalmanac.org/games/aStarTutorial.htm" target="_blank">here</a> and created my own implementation using object oriented c++. Now when I have say 32 x 32 grid, and I need to move 1 unit, it takes for about 1.2 seconds to finish. If I use a smaller grid, say 16 x 16, it is much faster. What optimizations do you recommend so that my path finding will become faster?<br />
<br />
This is my code:<br />
 <pre style="margin:20px; line-height:13px">stack&lt;Node*&gt; AStar::generatePath(Node *start, Node *end, MyMap *map) {<br />
Node*** grid = map-&gt;getNodes();<br />
int width = map-&gt;getWidth();<br />
int height = map-&gt;getHeight();<br />
<br />
//reset node values<br />
for (int i = 0; i &lt; height; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int j = 0; j &lt; width; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; grid[j][i]-&gt;reset();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
stack&lt;Node*&gt; paths;<br />
list&lt;Node*&gt; opened;<br />
list&lt;Node*&gt; closed;<br />
Node *current;<br />
//make sure start and end is not equal<br />
if ((start-&gt;getX() == end-&gt;getX()) &amp;&amp; (start-&gt;getY() == end-&gt;getY())) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;start and end positions are equal&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return paths;<br />
}<br />
//step 1<br />
opened.push_back(start);<br />
//step 2<br />
while ((!listContains(closed, end)) || (opened.size() != 0)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; //a<br />
&nbsp; &nbsp; &nbsp; &nbsp; current = getLowestF(opened);<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (current == NULL) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;current == null&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; //b<br />
&nbsp; &nbsp; &nbsp; &nbsp; opened.remove(current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; closed.push_back(current);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //c<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = -1; i &lt;= 1; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (int j = -1; j &lt;= 1; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //traverse all nodes 1 unit from the current<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (((i != 0) || (j != 0)) &amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (j + current-&gt;getY() &gt;= 0) &amp;&amp; (j + current-&gt;getY() &lt; height) &amp;&amp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (i + current-&gt;getX() &gt;= 0) &amp;&amp; (i + current-&gt;getX() &lt; width)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //check if next node is in diagonal<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((fabs(i) == 1) &amp;&amp; (fabs(j) == 1)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //make sure ver and hor nodes are walkable when moving diagonally<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!grid[i + current-&gt;getX()][current-&gt;getY()]-&gt;isWalkable()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!grid[current-&gt;getX()][j + current-&gt;getY()]-&gt;isWalkable()) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Node *child = grid[i + current-&gt;getX()][j + current-&gt;getY()];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c 1<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((child-&gt;isWalkable() &amp;&amp; !listContains(closed, child)) ||<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ((child-&gt;getX() == end-&gt;getX()) &amp;&amp; (child-&gt;getY() == end-&gt;getY()) &amp;&amp; !listContains(closed, child))) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c 2<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!listContains(opened, child)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c 2 i<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opened.push_back(child);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c 2 ii<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child-&gt;setParent(current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c 2 iii<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; computeValues(child, current, end);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //c 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (child-&gt;getGValue() &gt; newGValue(child, current)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //change child's parent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child-&gt;setParent(current);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child-&gt;setGValue(newGValue(child, current));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
}<br />
}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; //step 3<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (end-&gt;getParent() == NULL) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;no path found!&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addToPath(paths, end);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //pop the source node<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; paths.pop();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;found path!&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return paths;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>racumin</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236239.html</guid>
		</item>
		<item>
			<title>structures with pointers</title>
			<link>http://www.daniweb.com/forums/thread236233.html</link>
			<pubDate>Thu, 05 Nov 2009 10:47:59 GMT</pubDate>
			<description>Hello  
I have given a program in which i have to declare structure to store account ID, amount, user name and address. It inputs the number of account holders from the user and creat a dynamic array of structures to store the records of accounts. The program should declare two functions i.e. one...</description>
			<content:encoded><![CDATA[<div>Hello <br />
I have given a program in which i have to declare structure to store account ID, amount, user name and address. It inputs the number of account holders from the user and creat a dynamic array of structures to store the records of accounts. The program should declare two functions i.e. one for getting input from the user and other for showing records to the user.But my program is not fulfilling the requirements. It is not taking the inputs of name and address as it should. Got confused how to solve it.<br />
 <pre style="margin:20px; line-height:13px"> #include&lt;iostream.h&gt;<br />
#include&lt;conio.h&gt;<br />
struct acc<br />
{<br />
int id;<br />
double amount;<br />
char name[50];<br />
char add[150];<br />
};<br />
void input(acc *,int);<br />
void output( acc *,int);<br />
void main()<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout&lt;&lt;&quot;Enter total number of accounts:&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin&gt;&gt;n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; acc *ptr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ptr=new acc[n];<br />
&nbsp; &nbsp; &nbsp; &nbsp; input(ptr,n);<br />
&nbsp; &nbsp; &nbsp; &nbsp; output(ptr,n);<br />
&nbsp; &nbsp; &nbsp; &nbsp; delete []ptr;<br />
<br />
&nbsp; &nbsp; &nbsp;  getch();<br />
<br />
&nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp;  void input(acc* x,int t)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  int i;<br />
&nbsp; &nbsp; &nbsp;  for(i=0;i&lt;t;i++)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;Enter customer id:&quot;;<br />
&nbsp; &nbsp; &nbsp;  cin&gt;&gt;x-&gt;id;<br />
&nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;Enter the name : &quot;;<br />
&nbsp; &nbsp; &nbsp;  cin.get(x-&gt;name, 50);<br />
&nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;Enter amount:&quot;;<br />
&nbsp; &nbsp; &nbsp;  cin&gt;&gt;x-&gt;amount;<br />
&nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;Enter the address&quot;;<br />
&nbsp; &nbsp; &nbsp;  cin.get(x-&gt;add, 150);<br />
&nbsp; &nbsp; &nbsp;  x++;<br />
&nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp;  void output(acc* y,int t)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  for(int i=0;i&lt;t;i++)<br />
&nbsp; &nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp;  cout&lt;&lt;&quot;Id :&quot;&lt;&lt;y-&gt;id&lt;&lt;&quot; name is : &quot;&lt;&lt;y-&gt;name&lt;&lt;&quot; amount: &quot;;<br />
&nbsp; &nbsp; &nbsp;  cout&lt;&lt;y-&gt;amount&lt;&lt;&quot; address is : &quot;&lt;&lt;y-&gt;add&lt;&lt;endl;<br />
&nbsp; &nbsp; &nbsp;  y++;<br />
&nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp; &nbsp;  }</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>the great</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236233.html</guid>
		</item>
		<item>
			<title>C++ Double Queue</title>
			<link>http://www.daniweb.com/forums/thread236224.html</link>
			<pubDate>Thu, 05 Nov 2009 10:09:12 GMT</pubDate>
			<description>Hello! 
May I know about  Double Queue with complete examples. 
thank you.</description>
			<content:encoded><![CDATA[<div>Hello!<br />
May I know about  Double Queue with complete examples.<br />
thank you.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>kochan</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236224.html</guid>
		</item>
		<item>
			<title>C++, how to read one character/encrypt?</title>
			<link>http://www.daniweb.com/forums/thread236219.html</link>
			<pubDate>Thu, 05 Nov 2009 09:41:18 GMT</pubDate>
			<description><![CDATA[This is basically my code. It says build succeed, but I get nothing. What am I doing wrong. 
 
The user inputs a sentence, for example, Hello.  (I've taken out other parts such as return LOWERCASE, return DIGIT, and what would happen in those cases for ease of reading). 
 
The program should then...]]></description>
			<content:encoded><![CDATA[<div>This is basically my code. It says build succeed, but I get nothing. What am I doing wrong.<br />
<br />
The user inputs a sentence, for example, Hello.  (I've taken out other parts such as return LOWERCASE, return DIGIT, and what would happen in those cases for ease of reading).<br />
<br />
The program should then encrypt accordingly but it's not doing that.  It would take the first character, pass that through my function getTypeOfChar.  <br />
<br />
It runs, but it comes out with nothing when i input a sentence.  I've tried a for loop with array, but no matter what the currentChar doesnt seem to pass to the function<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
#include &lt;iostream&gt;<br />
#include &quot;ctype.h&quot;<br />
#include &lt;string&gt;<br />
<br />
<br />
using namespace std;<br />
<br />
<br />
const int UPPERCASE = 0;<br />
const int OTHER = 5;<br />
<br />
<br />
string storedSentence;<br />
<br />
<br />
void storeChar(char aChar);<br />
<br />
void printStoredSentence();<br />
<br />
<br />
char getTypeOfChar(char aChar) {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; if (int(aChar) &gt;= 65 &amp;&amp; int(aChar) &lt;= 90) <br />
&nbsp; &nbsp; &nbsp; &nbsp; return UPPERCASE;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; return OTHER;<br />
}<br />
<br />
void encryptor() {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; char sentence[200];<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the sentence to be encrypted: &quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; cin.getline( sentence, 200, '\n');<br />
<br />
&nbsp; &nbsp; char currentChar = 0;&nbsp; &nbsp; <br />
&nbsp; &nbsp; char encryptedChar = 0;<br />
&nbsp; &nbsp; do {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Don't know how to read the character from the sentence and pass it below to the function/switch statement<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; switch (getTypeOfChar(currentChar)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case UPPERCASE:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (currentChar == 'Z') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encryptedChar = 'a';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encryptedChar = int(tolower(currentChar)) + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encryptedChar = currentChar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; storeChar(encryptedChar);<br />
&nbsp; &nbsp; } while (currentChar != '\n');<br />
<br />
&nbsp; &nbsp; printStoredSentence();<br />
}<br />
<br />
<br />
void decryptor() {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; char sentence[200]<br />
<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the sentence to be decrypted: &quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.getline( sentence, 200, '\n');<br />
<br />
&nbsp; &nbsp; char currentChar = 0;<br />
&nbsp; &nbsp; char decryptedChar = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; do {<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Don't know how to read the character from the sentence and pass it below to the function/switch statement<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; switch (getTypeOfChar(currentChar)) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case UPPERCASE:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (currentChar == 'A') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decryptedChar = 'z';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  decryptedChar = int(tolower(currentChar)) + 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  decryptedChar = currentChar;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; storeChar(decryptedChar);<br />
&nbsp; &nbsp; } while (currentChar != '\n');<br />
<br />
&nbsp; &nbsp; printStoredSentence();<br />
}<br />
<br />
int main() {<br />
&nbsp; &nbsp; bool shouldContinue = true;<br />
<br />
&nbsp; &nbsp; do {<br />
&nbsp; &nbsp; &nbsp; &nbsp; int choice = 0;&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please select:&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;1. Encrypt a sentence&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;2. Decrypt a sentence&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;3. Exit&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Your choice:&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; choice;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; cin.get();<br />
&nbsp; &nbsp; &nbsp; &nbsp; switch (choice) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; encryptor();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; decryptor();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; shouldContinue = false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please input 1, 2 or 3&quot; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; } while (shouldContinue);<br />
<br />
&nbsp; &nbsp; return 0;<br />
}<br />
<br />
<br />
<br />
void storeChar(char aChar) {<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; storedSentence += aChar;<br />
}<br />
<br />
void printStoredSentence() {<br />
&nbsp; &nbsp; cout &lt;&lt; storedSentence &lt;&lt; endl;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; storedSentence.clear();<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>EastJohn</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236219.html</guid>
		</item>
		<item>
			<title><![CDATA[Need help with an error that I don't know how to fix, and have never seen it before.]]></title>
			<link>http://www.daniweb.com/forums/thread236158.html</link>
			<pubDate>Thu, 05 Nov 2009 06:40:44 GMT</pubDate>
			<description><![CDATA[When I try to compile my code, I get this error: 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680" class="thickbox" title="Help with Code Tags" target="_blank">Help with Code...]]></description>
			<content:encoded><![CDATA[<div>When I try to compile my code, I get this error:<br />
 <pre style="margin:20px; line-height:13px">------ Build started: Project: SUD, Configuration: Debug Win32 ------<br />
Compiling...<br />
baseent.cpp<br />
c:\program files\microsoft visual studio 9.0\vc\include\xmemory(52) : error C2558: class 'BaseEnt' : no copy constructor available or copy constructor is declared 'explicit'<br />
&nbsp; &nbsp; &nbsp; &nbsp; c:\program files\microsoft visual studio 9.0\vc\include\xmemory(155) : see reference to function template instantiation 'void std::_Construct&lt;BaseEnt,_Ty&gt;(_T1 *,const _T2 &amp;)' being compiled<br />
&nbsp; &nbsp; &nbsp; &nbsp; with<br />
&nbsp; &nbsp; &nbsp; &nbsp; [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Ty=BaseEnt,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _T1=BaseEnt,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _T2=BaseEnt<br />
&nbsp; &nbsp; &nbsp; &nbsp; ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; c:\program files\microsoft visual studio 9.0\vc\include\xmemory(154) : while compiling class template member function 'void std::allocator&lt;_Ty&gt;::construct(BaseEnt *,const _Ty &amp;)'<br />
&nbsp; &nbsp; &nbsp; &nbsp; with<br />
&nbsp; &nbsp; &nbsp; &nbsp; [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Ty=BaseEnt<br />
&nbsp; &nbsp; &nbsp; &nbsp; ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; c:\program files\microsoft visual studio 9.0\vc\include\vector(429) : see reference to class template instantiation 'std::allocator&lt;_Ty&gt;' being compiled<br />
&nbsp; &nbsp; &nbsp; &nbsp; with<br />
&nbsp; &nbsp; &nbsp; &nbsp; [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Ty=BaseEnt<br />
&nbsp; &nbsp; &nbsp; &nbsp; ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; c:\program files\microsoft visual studio 9.0\vc\include\vector(439) : see reference to class template instantiation 'std::_Vector_val&lt;_Ty,_Alloc&gt;' being compiled<br />
&nbsp; &nbsp; &nbsp; &nbsp; with<br />
&nbsp; &nbsp; &nbsp; &nbsp; [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Ty=BaseEnt,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Alloc=std::allocator&lt;BaseEnt&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ]<br />
&nbsp; &nbsp; &nbsp; &nbsp; c:\documents and settings\tom\my documents\visual studio 2008\projects\sud\sud\baseent.h(25) : see reference to class template instantiation 'std::vector&lt;_Ty&gt;' being compiled<br />
&nbsp; &nbsp; &nbsp; &nbsp; with<br />
&nbsp; &nbsp; &nbsp; &nbsp; [<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _Ty=BaseEnt<br />
&nbsp; &nbsp; &nbsp; &nbsp; ]<br />
Generating Code...<br />
Compiling...<br />
main.cpp<br />
Generating Code...<br />
Build log was saved at &quot;file://c:\Documents and Settings\tom\My Documents\Visual Studio 2008\Projects\SUD\SUD\Debug\BuildLog.htm&quot;<br />
SUD - 1 error(s), 0 warning(s)<br />
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========</pre><br />
I clicked on it, and it pointed me to this line of code:<br />
 <pre style="margin:20px; line-height:13px">extern std::vector&lt;BaseEnt&gt; entities;</pre><br />
This is where BaseEnt is defined:<br />
<br />
 <pre style="margin:20px; line-height:13px">class BaseEnt{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int id;<br />
&nbsp; &nbsp; &nbsp; &nbsp; static int count;<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::string hashcode;<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::string name;<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; BaseEnt();<br />
&nbsp; &nbsp; &nbsp; &nbsp; BaseEnt(std::string name);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BaseEnt(BaseEnt &amp;other);<br />
&nbsp; &nbsp; &nbsp; &nbsp; ~BaseEnt();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; int GetID();<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::string GetHashCode();<br />
&nbsp; &nbsp; &nbsp; &nbsp; std::string GetClassName();<br />
&nbsp; &nbsp; int GetCount();<br />
};</pre><br />
This is where it's member definitions are:<br />
 <pre style="margin:20px; line-height:13px">int BaseEnt::count = 1;<br />
<br />
std::vector&lt;BaseEnt&gt; entities(;<br />
<br />
BaseEnt::BaseEnt()<br />
:id(count), name(&quot;unassigned&quot;), hashcode(HashCode())<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; name += HashCode();<br />
&nbsp; &nbsp; &nbsp; &nbsp; entities[id] = *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
}<br />
<br />
BaseEnt::BaseEnt(std::string classname)<br />
:id(count), name(classname), hashcode(HashCode())<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; entities[id] = *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
}<br />
<br />
BaseEnt::BaseEnt(BaseEnt &amp;other)<br />
:id(other.GetID()), name(other.GetClassName()), hashcode(other.GetHashCode())<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; entities[id] = *this;<br />
&nbsp; &nbsp; &nbsp; &nbsp; count++;<br />
}<br />
<br />
BaseEnt::~BaseEnt()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; count--;<br />
}<br />
<br />
std::string BaseEnt::GetClassName()<br />
{ return name; }<br />
int BaseEnt::GetCount()<br />
{ return BaseEnt::count; }<br />
std::string BaseEnt::GetHashCode()<br />
{ return hashcode; }<br />
int BaseEnt::GetID()<br />
{ return id; }</pre><br />
I have never seen this error, and I can't figure out what it means, because I've got a copy constructor in my class(line  9).<br />
<br />
And help will be appreciated.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>tomtetlaw</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236158.html</guid>
		</item>
		<item>
			<title>10 question math quiz</title>
			<link>http://www.daniweb.com/forums/thread236157.html</link>
			<pubDate>Thu, 05 Nov 2009 06:33:36 GMT</pubDate>
			<description>Hi, this is one of my hw problems for the week and having trouble writing this code.-- 
 
QUESTION: 
1.	Create a program that will generate a 10 question math quiz for single digit addition.  Your program should create 2 random numbers in the range of 0 – 9 and then ask the user to solve the...</description>
			<content:encoded><![CDATA[<div>Hi, this is one of my hw problems for the week and having trouble writing this code.--<br />
<br />
QUESTION:<br />
1.	Create a program that will generate a 10 question math quiz for single digit addition.  Your program should create 2 random numbers in the range of 0 – 9 and then ask the user to solve the equation.  Let the user know if they answered correctly or not.  If not, show them what the correct answer is.  After the user has answered 10 questions, display the score as a percentage out of 100.  Your program should allow the user to take as many 10 question exams as he wants.<br />
-----<br />
<br />
The code ive writtin i was testing things with the varibles to do random 1-10 numbers, (teacher took 2 min to explain).    My code is most defiently sloppy but im working hard on it. <br />
<br />
/**********************************************************************<br />
 *Program Description:  program that will generate a 10 question math <br />
 *	quiz for single digit addition.  <br />
 *BEGIN Program 2 - Math Quiz<br />
 *	Create two random numbers of range 0-9 in addition form <br />
 *	Ask user to solve equation<br />
 *  WHILE User asnwers each question<br />
 *		Add 1 to count <br />
 *		Add 10 to total if correct answer<br />
 *		IF Wrong answer display wronge answer message go to next.  <br />
 *      Display correct answer<br />
 *		ELSE if answer right display correct answer go to next<br />
 *		Stop if count == 10<br />
 *	END WHILE<br />
 *  Display Total in percent form<br />
 *END Program 2 - Math quiz<br />
 *********************************************************************/<br />
#include &lt;ctime&gt;<br />
#include &lt;cstdlib&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;iomanip&gt;<br />
using namespace std;<br />
int main() <br />
<br />
{<br />
//Local constants<br />
int Count = 0; //Total questions<br />
int Total = 0; //Percentage score<br />
<br />
//Local variables<br />
int Num1    = rand() % 10; //Random number 1-10<br />
int Num2    = rand() % 10; //Random number 1-10<br />
int Num3    = rand() % 10; //Random number 1-10<br />
int Num4    = rand() % 10; //Random number 1-10<br />
int Num5    = rand() % 10; //Random number 1-10<br />
int Num6    = rand() % 10; //Random number 1-10<br />
int Num7    = rand() % 10; //Random number 1-10<br />
int Num8    = rand() % 10; //Random number 1-10<br />
int Num9    = rand() % 10; //Random number 1-10<br />
int Num10   = rand() % 10; //Random number 1-10<br />
int Num11   = rand() % 10; //Random number 1-10<br />
int Num12   = rand() % 10; //Random number 1-10<br />
int Num13   = rand() % 10; //Random number 1-10<br />
int Num14   = rand() % 10; //Random number 1-10<br />
int Num15   = rand() % 10; //Random number 1-10<br />
int Num16   = rand() % 10; //Random number 1-10<br />
int Num17   = rand() % 10; //Random number 1-10<br />
int Num18   = rand() % 10; //Random number 1-10<br />
int Num19   = rand() % 10; //Random number 1-10<br />
int Num20   = rand() % 10; //Random number 1-10<br />
int Correct = Num1 + Num2 ;<br />
<br />
//Reference<br />
int Answer ;<br />
<br />
/**********************************************************************/<br />
<br />
  srand(time(NULL));<br />
  <br />
  <br />
	 <br />
	cout &lt;&lt; &quot;\n\n\n\n\n\n&quot;;<br />
	cout &lt;&lt; setw (40) &lt;&lt; &quot;Math Quiz&quot; &lt;&lt; endl ;<br />
	<br />
	//While Count is less then ten<br />
	while (Count &lt;= 10)<br />
	cout &lt;&lt; rand() % 10 + rand() % 10 &lt;&lt; endl;<br />
		cin &gt;&gt; Answer ;<br />
		Count ++;<br />
<br />
	if (Answer == Correct)<br />
	{<br />
		Count++ ;<br />
			Total = Total + 10 ;<br />
			cout &lt;&lt; &quot;Correct!&quot; &lt;&lt; endl ;<br />
	}<br />
	else (Answer != Correct);<br />
	{<br />
<br />
		cout &lt;&lt; setw (40) &lt;&lt; &quot;Incorrect!&quot; &lt;&lt; endl;<br />
	}<br />
	//For grade<br />
	for (Total = Count * 10;Count &lt;= 10; Count++);<br />
	cout &lt;&lt; setw (37) &lt;&lt; Total &lt;&lt; endl;<br />
return 0; <br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>ninatech9</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236157.html</guid>
		</item>
		<item>
			<title>dynamically allocate array of object</title>
			<link>http://www.daniweb.com/forums/thread236147.html</link>
			<pubDate>Thu, 05 Nov 2009 05:16:11 GMT</pubDate>
			<description><![CDATA[The code is evaluating a expression tree.  
My issue is on line 57 when I try to dynamically allocate an array to be used as the nodes in the expression tree, the compiler gives the following error: 
tree.cpp(58): error: no suitable constructor exists to convert from "ExprNode *" to "ExprNode" 
   ...]]></description>
			<content:encoded><![CDATA[<div>The code is evaluating a expression tree. <br />
My issue is on line 57 when I try to dynamically allocate an array to be used as the nodes in the expression tree, the compiler gives the following error:<br />
tree.cpp(58): error: no suitable constructor exists to convert from &quot;ExprNode *&quot; to &quot;ExprNode&quot;<br />
      pN[0] = new ExprNode('+', new ExprNode(5), new ExprNode(6));<br />
<br />
What do I need to change?<br />
<br />
Thanks.<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;cstdlib&gt;&nbsp; // for NULL<br />
#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
//====================================== class ExprNode<br />
class ExprNode {<br />
&nbsp;public:<br />
&nbsp; &nbsp; ExprNode(){};<br />
&nbsp; &nbsp; ExprNode(char oper, ExprNode* left, ExprNode* right);<br />
&nbsp; &nbsp; ExprNode(int val);<br />
&nbsp; &nbsp; int eval() const; // Evaluate expr tree. Return result.<br />
&nbsp; &nbsp; <br />
&nbsp;private:<br />
&nbsp; &nbsp; char&nbsp; &nbsp; &nbsp; _op;&nbsp; &nbsp; // one of +, -, *, /, #<br />
&nbsp; &nbsp; int&nbsp; &nbsp; &nbsp;  _value; // integer value used for constants.<br />
&nbsp; &nbsp; ExprNode* _left;&nbsp; // left subtree<br />
&nbsp; &nbsp; ExprNode* _right; // right subtree<br />
};<br />
//============================================= ExprNode constructor<br />
&nbsp; &nbsp; // Constructs node for a binary operator.<br />
ExprNode::ExprNode(char oper, ExprNode* left, ExprNode* right) {<br />
&nbsp; &nbsp; _op&nbsp; &nbsp; = oper;<br />
&nbsp; &nbsp; _left&nbsp; = left;<br />
&nbsp; &nbsp; _right = right;<br />
}<br />
&nbsp;  <br />
//============================================== ExprNode constructor<br />
&nbsp; &nbsp; // Constructs a node for an integer constant<br />
ExprNode::ExprNode(int v) {<br />
&nbsp; &nbsp; _op&nbsp; &nbsp; = '#';<br />
&nbsp; &nbsp; _value = v;<br />
&nbsp; &nbsp; _left&nbsp; = NULL;<br />
&nbsp; &nbsp; _right = NULL;<br />
}<br />
<br />
//===================================================== ExprNode::eval<br />
int ExprNode::eval() const {<br />
&nbsp; &nbsp; // Recursively evaluate expression tree and return result.<br />
&nbsp; &nbsp; int result;<br />
&nbsp; &nbsp; switch (_op) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; case '+': <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = _left-&gt;eval() + _right-&gt;eval();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; case '-': <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = _left-&gt;eval() - _right-&gt;eval();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; case '#': <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = _value;&nbsp; // an integer constant<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  return result;<br />
}<br />
<br />
//============================================================== main<br />
int main() {<br />
&nbsp; &nbsp; // Example expression and evaluation.<br />
&nbsp; &nbsp; ExprNode* pN = new ExprNode&#91;2&#93;;<br />
&nbsp; &nbsp; pN&#91;0&#93; = new ExprNode('+', new ExprNode(5), new ExprNode(6));<br />
&nbsp; &nbsp; pN&#91;1&#93; = new ExprNode('-', pN&#91;0&#93;, new ExprNode(2));<br />
&nbsp; &nbsp; cout &lt;&lt; pN&#91;1&#93;-&gt;eval() &lt;&lt; endl;<br />
&nbsp;  delete &#91;&#93; pN; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>mike.bauer</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236147.html</guid>
		</item>
		<item>
			<title>Associating an icon with a custom file type</title>
			<link>http://www.daniweb.com/forums/thread236144.html</link>
			<pubDate>Thu, 05 Nov 2009 05:08:45 GMT</pubDate>
			<description><![CDATA[I was wondering if it was possible to use c++ to associate a specific icon with a custom file type.  
for example, I create a file with fopen(testfile.rider, "wb");  
It creates a file with an extension of .rider, but it has the default unkown file type icon. Is there a way to automatically give...]]></description>
			<content:encoded><![CDATA[<div>I was wondering if it was possible to use c++ to associate a specific icon with a custom file type. <br />
for example, I create a file with fopen(testfile.rider, &quot;wb&quot;); <br />
It creates a file with an extension of .rider, but it has the default unkown file type icon. Is there a way to automatically give each .rider file a non-default icon? Creating the icon itself is no problem.<br />
<br />
<br />
Thanks,<br />
riderrocker</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>riderrocker</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236144.html</guid>
		</item>
		<item>
			<title>Finding the highest and the lowest number out of 5 inputs...</title>
			<link>http://www.daniweb.com/forums/thread236141.html</link>
			<pubDate>Thu, 05 Nov 2009 04:26:11 GMT</pubDate>
			<description><![CDATA[Help!!! 
 
 
I'm trying to eliminate the highest and lowest number out of 5 inputs then get the average of the remaining 3 inputs... 
In some instances, it gives me incorrect average.. 
(We are not suppose to use arrays yet) 
 
Here's my code:]]></description>
			<content:encoded><![CDATA[<div>Help!!!<br />
<br />
<br />
I'm trying to eliminate the highest and lowest number out of 5 inputs then get the average of the remaining 3 inputs...<br />
In some instances, it gives me incorrect average..<br />
(We are not suppose to use arrays yet)<br />
<br />
Here's my code:<br />
<br />
<br />
#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
void getData(double&amp; input1, double&amp; input2, double&amp; input3, double&amp; input4, double&amp; input5);<br />
//Ask the user to input numbers<br />
<br />
void calcscore(double&amp; num1, double&amp; num2, double&amp; num3, double&amp; num4, double&amp; num5);<br />
//should calculate and display the average of the 3 remaining numbers<br />
<br />
int main()<br />
{<br />
	double score1, score2, score3, score4, score5;<br />
<br />
	getData(score1, score2, score3, score4, score5);<br />
	calcscore(score1, score2, score3, score4, score5);<br />
<br />
}<br />
<br />
void getData(double&amp; input1, double&amp; input2, double&amp; input3, double&amp; input4, double&amp; input5)<br />
{<br />
<br />
	<br />
	<br />
	cout&lt;&lt;&quot;Input 5 numbers :  \n&quot;;<br />
	cin&gt;&gt; input1<br />
	   &gt;&gt; input2<br />
	   &gt;&gt; input3<br />
	   &gt;&gt; input4<br />
	   &gt;&gt; input5;<br />
	<br />
<br />
}<br />
<br />
void calcscore(double&amp; num1, double&amp; num2, double&amp; num3, double&amp; num4, double&amp; num5)<br />
{<br />
	<br />
<br />
	if (0 &gt; num2&amp;&amp;num3&amp;&amp;num1&amp;&amp;num5&amp;&amp;num4)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Error! Please enter numbers between 0 to 10 only&quot;  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
	<br />
	}<br />
	<br />
	<br />
	else if (num1 &gt; num2&amp;&amp;num3&amp;&amp;num4 &gt; num5)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num2 + num3 + num4)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num2 &gt; num1&amp;&amp;num3&amp;&amp;num4 &gt; num5)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num1 + num3 + num4)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num3 &gt; num1&amp;&amp;num2&amp;&amp;num4 &gt; num5)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num1 + num2 + num4)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num4 &gt; num1&amp;&amp;num2&amp;&amp;num3 &gt; num5)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num1 + num2 + num3)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
<br />
	else if (num5 &gt; num4&amp;&amp;num2&amp;&amp;num3 &gt; num1)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num4 + num2 + num3)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num1 &gt; num5&amp;&amp;num2&amp;&amp;num3 &gt; num4)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num5 + num2 + num3)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
<br />
	else if (num2 &gt; num5&amp;&amp;num1&amp;&amp;num3 &gt; num4)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num5 + num1 + num3)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num3 &gt; num5&amp;&amp;num2&amp;&amp;num1 &gt; num4)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num5 + num2 + num1)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num5 &gt; num1&amp;&amp;num2&amp;&amp;num3 &gt; num4)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num1 + num2 + num3)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num4 &gt; num1&amp;&amp;num2&amp;&amp;num5 &gt; num3)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num1 + num2 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
		<br />
	else if (num1 &gt; num4&amp;&amp;num2&amp;&amp;num5 &gt; num3)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num4 + num2 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num2 &gt; num4&amp;&amp;num1&amp;&amp;num5 &gt; num3)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num4 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
	<br />
	else if (num4 &gt; num2&amp;&amp;num1&amp;&amp;num5 &gt; num3)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num2 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num5 &gt; num2&amp;&amp;num1&amp;&amp;num4 &gt; num3)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num2 + num1 + num4)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
	else if (num3 &gt; num4&amp;&amp;num1&amp;&amp;num5 &gt; num2)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num4 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
	else if (num1 &gt; num2&amp;&amp;num1&amp;&amp;num5 &gt; num2)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num2 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
	else if (num3 &gt; num4&amp;&amp;num1&amp;&amp;num5 &gt; num2)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num4 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
	else if (num4 &gt; num3&amp;&amp;num1&amp;&amp;num5 &gt; num2)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num3 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
	else if (num5 &gt; num3&amp;&amp;num1&amp;&amp;num4 &gt; num2)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num3 + num1 + num4)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
	else if (num2 &gt; num3&amp;&amp;num1&amp;&amp;num5 &gt; num4)<br />
	{<br />
			<br />
			cout&lt;&lt;&quot;Average: &quot;&lt;&lt;(num3 + num1 + num5)/3  ;<br />
			cout&lt;&lt;&quot;\n\n\n&quot;;<br />
		}<br />
<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>violet101</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236141.html</guid>
		</item>
		<item>
			<title><![CDATA[why isn't the program running]]></title>
			<link>http://www.daniweb.com/forums/thread236129.html</link>
			<pubDate>Thu, 05 Nov 2009 03:59:03 GMT</pubDate>
			<description><![CDATA[It has no errors or warnings but nothing is working what could be the problem and the assignment says that I need to a finish commenting the function header blocks. ( i don't know what that is and I don't know if this is the reason that it is not working) 
 
  <div class="codeblock"> <div...]]></description>
			<content:encoded><![CDATA[<div>It has no errors or warnings but nothing is working what could be the problem and the assignment says that I need to a finish commenting the function header blocks. ( i don't know what that is and I don't know if this is the reason that it is not working)<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
// Constant for array sizes<br />
const int SIZE = 20;<br />
<br />
// Function prototypes<br />
int bubbleSort(long [], int);&nbsp; <br />
int selectionSort(long [], int);<br />
<br />
int main()<br />
{<br />
&nbsp;  int exchanges; // Number of exchanges made<br />
<br />
&nbsp;  // Two arrays with identical values<br />
&nbsp;  long accounts1[SIZE] =<br />
&nbsp; &nbsp; &nbsp; { 5658845,&nbsp; 4520125,&nbsp; 7895122,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 8777541,&nbsp; 8451277,&nbsp; 1302850,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 8080152,&nbsp; 4562555,&nbsp; 5552012,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 5050552,&nbsp; 7825877,&nbsp; 1250255,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 1005231,&nbsp; 6545231,&nbsp; 3852085,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 7576651,&nbsp; 7881200,&nbsp; 4581002 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  long accounts2[SIZE] = <br />
&nbsp; &nbsp; &nbsp; { 5658845,&nbsp; 4520125,&nbsp; 7895122,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 8777541,&nbsp; 8451277,&nbsp; 1302850,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 8080152,&nbsp; 4562555,&nbsp; 5552012,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 5050552,&nbsp; 7825877,&nbsp; 1250255,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 1005231,&nbsp; 6545231,&nbsp; 3852085,<br />
&nbsp; &nbsp; &nbsp; &nbsp; 7576651,&nbsp; 7881200,&nbsp; 4581002 };<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;  // Sort accounts1 with bubble sort. The function<br />
&nbsp;  // returns the number of exchanges made.<br />
&nbsp;  exchanges = bubbleSort(accounts1, SIZE);<br />
&nbsp;  <br />
&nbsp;  // Display the number of exchanges made by the<br />
&nbsp;  // bubble sort.<br />
&nbsp;  cout &lt;&lt; &quot;\n&quot; &lt;&lt; exchanges <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; &quot; exchanges were made by Bubble Sort.&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; endl;<br />
<br />
&nbsp;  // Sort accounts2 with selection sort. The function<br />
&nbsp;  // returns the number of exchanges made.<br />
&nbsp;  exchanges = selectionSort(accounts2, SIZE);<br />
&nbsp;  cout &lt;&lt; &quot;\n&quot; &lt;&lt; exchanges <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt;&nbsp; &quot; exchanges were made by Selection Sort.&quot; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;&lt; endl;<br />
<br />
&nbsp;  return 0;<br />
}<br />
<br />
int bubbleSort(long array[], int size)<br />
{<br />
&nbsp;  bool swap;<br />
&nbsp;  long temp;<br />
&nbsp;  int&nbsp; exchanges = 0;<br />
<br />
&nbsp;  do<br />
&nbsp;  {<br />
&nbsp; &nbsp; &nbsp; swap = false;&nbsp;  // No swaps made yet on this pass.<br />
<br />
for (int count = 0; count &lt; (size -1); count++)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (array[count] &gt; array[count + 1])<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; temp = array[count];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[count] = array[count + 1];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[count + 1] = temp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; swap = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
&nbsp;  } while (swap);&nbsp; // Same as&nbsp; while (swaps == true);<br />
<br />
&nbsp;  return exchanges;<br />
}<br />
<br />
<br />
int selectionSort(long array[], int size)<br />
{<br />
&nbsp;  int&nbsp; startScan,&nbsp; &nbsp; // Array indexes to be compared<br />
&nbsp; &nbsp; &nbsp; &nbsp; minIndex,<br />
&nbsp; &nbsp; &nbsp; &nbsp; exchanges = 0;<br />
&nbsp;  long minValue;<br />
&nbsp; <br />
<br />
&nbsp; &nbsp; void selectionSort(int array[], int size);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (startScan = 0; startScan &lt; (size - 1); startScan++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minIndex = startScan;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minValue = array[startScan];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for(int index = startScan +1; index &lt; size; index++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (array[index] &lt; minValue)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minValue = array[index];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minIndex = index;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[minIndex] = array[startScan];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array[startScan] = minValue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; // Move values to their new positions<br />
&nbsp; &nbsp; &nbsp; array[minIndex]&nbsp; = array[startScan];<br />
&nbsp; &nbsp; &nbsp; array[startScan] = minValue;<br />
&nbsp; &nbsp; &nbsp; // Add the line to increment the number of exchanges.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; exchanges++;<br />
<br />
&nbsp;  } <br />
&nbsp;  return exchanges;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>rookanga</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236129.html</guid>
		</item>
		<item>
			<title>Connect 4 won function</title>
			<link>http://www.daniweb.com/forums/thread236118.html</link>
			<pubDate>Thu, 05 Nov 2009 02:41:30 GMT</pubDate>
			<description>I have already done most of the program, ask the user for the move, see if it is a valid move, make the move, test if the perimeter is full, etc... but now I see myself troubled with testing if someone has won the game, I could just make a lot of if and else if and test all the possible winning...</description>
			<content:encoded><![CDATA[<div>I have already done most of the program, ask the user for the move, see if it is a valid move, make the move, test if the perimeter is full, etc... but now I see myself troubled with testing if someone has won the game, I could just make a lot of if and else if and test all the possible winning moves, but I would like to know if there is any better way.<br />
<br />
The board is represented by a 2D array called board, 9 columns, 9 rows (board[9][9]), player 1's pieces are represented with the ascII code 88 and player 2's pieces with 79, if there is 4 88 in board[0][0], [0][1], [0][2], and [0][3] the player 1 would win, the same would be with diagonals: board[0][0], [1][1], [2][2], [3][3]. As I said, I suppose I can make it with a lot of ifs, but I would like to know if there is a better way.<br />
<br />
Thank you.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Kuroshi</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236118.html</guid>
		</item>
		<item>
			<title>Error message</title>
			<link>http://www.daniweb.com/forums/thread236113.html</link>
			<pubDate>Thu, 05 Nov 2009 02:19:49 GMT</pubDate>
			<description><![CDATA[I am writing a game code and I keep getting these erroes 359 E: Game.cpp redefinition of `void PlaceYourBet()'  155 E: Game.cpp `void PlaceYourBet()' previously defined here  can anyone help me out with these errors I know it must be simple.]]></description>
			<content:encoded><![CDATA[<div>I am writing a game code and I keep getting these erroes 359 E: Game.cpp redefinition of `void PlaceYourBet()'  155 E: Game.cpp `void PlaceYourBet()' previously defined here  can anyone help me out with these errors I know it must be simple.</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Grim279</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236113.html</guid>
		</item>
		<item>
			<title>How to set maximum length for EditControl (textBox)</title>
			<link>http://www.daniweb.com/forums/thread236109.html</link>
			<pubDate>Thu, 05 Nov 2009 01:46:21 GMT</pubDate>
			<description>Hi all,  
 
I now using Visual C++ (Visual Studio 2005) for my project. i face some problem in set the maximum length for my edit control(text box). 
 
i have 3 edit control in the same dialog. i want set the maximum length for each edit control = 5. 
 
following are the 3 ID of edit control in...</description>
			<content:encoded><![CDATA[<div>Hi all, <br />
<br />
I now using Visual C++ (Visual Studio 2005) for my project. i face some problem in set the maximum length for my edit control(text box).<br />
<br />
i have 3 edit control in the same dialog. i want set the maximum length for each edit control = 5.<br />
<br />
following are the 3 ID of edit control in same dialog:<br />
IDC_EDIT_MCNO<br />
IDC_EDIT_MCSERIALNO<br />
IDC_EDIT_LOCATION<br />
<br />
The dialog ID is: IDD_MACHINE<br />
<br />
Please guide me for set max length. <br />
<br />
Thanks very for your help. i will very appreciate. :) <br />
<br />
Regards:<br />
Alice  :)</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Alice86</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236109.html</guid>
		</item>
		<item>
			<title>Sooo.... I need help...</title>
			<link>http://www.daniweb.com/forums/thread236107.html</link>
			<pubDate>Thu, 05 Nov 2009 01:35:06 GMT</pubDate>
			<description><![CDATA[I've long looked at this site for advice, but I'm stuck now. I have an idea of WHAT I need to do, but don't know exactly how to do it. 
 
YES this is homework. NO I'm not asking for anyone to completely do it because I need to learn this stuff. YES I am asking for help and I'm not the brightest...]]></description>
			<content:encoded><![CDATA[<div>I've long looked at this site for advice, but I'm stuck now. I have an idea of WHAT I need to do, but don't know exactly how to do it.<br />
<br />
YES this is homework. NO I'm not asking for anyone to completely do it because I need to learn this stuff. YES I am asking for help and I'm not the brightest bulb so I need specifics...<br />
<br />
Here's my problem:<br />
1. Define the class Address that has 4 data members:<br />
• streetAddress: a string of a maximum of 50 characters<br />
• city: a string of a maximum of 30 characters<br />
• state: a string of a maximum of 30 characters<br />
• ZIP: integer.<br />
In addition to the data members, the class has functions to “set” and “get” the<br />
values of the data members as well as a function to display the contents of all the<br />
data members.<br />
a) Write the header file Address.h for this class. Your class definitions should<br />
not allow any function outside the class to access the data members.<br />
b) Write the implementation file Address.cpp which implements the member<br />
functions of the Address class.<br />
2. Define a class Student that has the following data members:<br />
• studentName: a string of a maximum of 30 characters<br />
• studentID: an integer that is unique for each student and is dynamically<br />
created when a new Student object is created.<br />
• studentAddress: an object of the Address class<br />
• GPA: a floating number<br />
In addition to the data members, the class has functions to “set” and “get” the<br />
values of the data members as well as a function to display the contents of all the<br />
data members.<br />
a) Write the header file Student.h for this class. Your class definitions should not<br />
allow any function outside the class to access the data members.<br />
b) Write the implementation file Student.cpp which implements the member<br />
functions of the Student class.<br />
3. Develop a “Course Roster Application” that allows the user to:<br />
• create a course roster of any number of students. (use dynamically<br />
allocated array of objects)<br />
• enter information for each student.<br />
• display information about a given student.<br />
• list all the students in the course.<br />
• display some statistics about the students enrolled in the course.<br />
The applications should start by displaying a menu that has the flowing options:<br />
1. Input a new roster.<br />
2. Display the information of a student.<br />
3. List all students registered in the class.<br />
4. Display statistics.<br />
5. Exit.<br />
•<br />
The first option should:<br />
o ask the user to enter the total number of students registered in the class<br />
o ask the user to enter the information for the students one student at a<br />
time. It should do the following for each student until the information<br />
for all the students is entered:<br />
create a Student object and automatically assign a new student<br />
ID to the new student. (Use simple serial numbering sequence<br />
that starts with 1 and is incremented every time a new student<br />
is added.)<br />
ask the user to input the following information for the student:<br />
• student name<br />
• street address<br />
• city<br />
• state<br />
• ZIP<br />
• GPA<br />
o After the user inputs the above fields for one student, the program<br />
should loop back to ask for the information of the next student until all<br />
students have been entered in the roster.<br />
•<br />
The second option should:<br />
o ask for the student ID then searches the roster for that student.<br />
o If it is found then student information’s is displayed otherwise a<br />
message should be displayed to indicate that the student is not<br />
registered in the course.<br />
•<br />
The third option should list all the students in the roster. Display only the ID,<br />
name, ZIP and the GPA.<br />
•<br />
The forth option will calculate and display the following:<br />
o The average GPA of the students in the course.<br />
o The lowest GPA.<br />
o The highest GPA.<br />
•<br />
The fifth option ends the application.<br />
Programming Guidelines:<br />
•<br />
The program should use dynamic memory allocation to create the roster.<br />
•<br />
Use the switch statement to implement the required menu.<br />
•<br />
Each menu option (other than the exit option) should be implemented as an<br />
individual function.<br />
•<br />
When the user selects an option from the menu (other than the exit option), the<br />
program should perform the selected task then display the menu again.<br />
•<br />
The program should end ONLY if the user selects the “Exit” option.<br />
•<br />
Make sure your program doesn’t have any memory leaks by releasing all the<br />
dynamically created memory when it is no longer needed.<br />
•<br />
Submit only the source code of your program:<br />
The header file for the Address class (Address.h)<br />
o<br />
The header file of the Student class (Student.h)<br />
o<br />
The implementation file for the Address class (Address.cpp)<br />
o<br />
o<br />
The implementation file of the Student class (Student.cpp)<br />
o<br />
The source file for the application (Roster.cpp)<br />
<br />
<br />
Here is my code so far...<br />
STUDENT.H<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
class Student<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char studentName[30];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int studentID; ///Figure this one out<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //char studentAddress streetAddress();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float GPA;<br />
&nbsp; &nbsp; &nbsp; &nbsp; public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char getName();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int getID();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char getStreet();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float getGPA();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setName(char*);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setID(int);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char setStreet();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; void setGPA(float);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //friend class Address; // friend of class Address<br />
};</pre><br />
STUDENT.CPP<br />
 <pre style="margin:20px; line-height:13px">#include &quot;Student.h&quot;<br />
using namespace std;<br />
<br />
char Student::getName()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return studentName[30];<br />
}<br />
<br />
int Student::getID()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return studentID;<br />
}<br />
<br />
/*string Student::getStreet()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;//just a test<br />
}*/<br />
<br />
float Student::getGPA()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return GPA;<br />
}<br />
<br />
void Student::setName(char *myName)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; strcpy_s(studentName, myName);<br />
}<br />
<br />
void Student::setID(int ID)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; ID; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; studentID = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; studentID++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
/*Student::setAddress()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;//just a test<br />
}*/<br />
<br />
void Student::setGPA(float myGPA)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; GPA = myGPA;<br />
}</pre><br />
ADDRESS.H<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream&gt;<br />
using namespace std;<br />
<br />
class Address<br />
{<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; char streetAddress[50];<br />
&nbsp; &nbsp; &nbsp; &nbsp; char city[30];<br />
&nbsp; &nbsp; &nbsp; &nbsp; char state[30];<br />
&nbsp; &nbsp; &nbsp; &nbsp; int zip;<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; char getStreet();<br />
&nbsp; &nbsp; &nbsp; &nbsp; char getCity();<br />
&nbsp; &nbsp; &nbsp; &nbsp; char getState();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int getZip();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setStreet(char*);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setCity(char*);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setState(char*);<br />
&nbsp; &nbsp; &nbsp; &nbsp; void setZip(int);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; friend class Student;<br />
};</pre><br />
ADDRESS.CCP<br />
 <pre style="margin:20px; line-height:13px">#include &quot;Address.h&quot;<br />
using namespace std;<br />
<br />
char Address::getStreet()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return streetAddress[50];<br />
}<br />
<br />
char Address::getCity()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return city[30];<br />
}<br />
<br />
char Address::getState()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return state[30];<br />
}<br />
<br />
int Address::getZip()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; return zip;<br />
}<br />
<br />
<br />
void Address::setStreet(char * myStreet)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; strcpy_s(streetAddress, myStreet);<br />
}<br />
<br />
<br />
void Address::setCity(char * myCity)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; strcpy_s(city, myCity);<br />
}<br />
<br />
<br />
void Address::setState(char * myState)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; strcpy_s(state, myState);<br />
}<br />
<br />
void Address::setZip(int myZip)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; zip = myZip;<br />
}</pre><br />
ROSTERAPP.CPP<br />
 <pre style="margin:20px; line-height:13px">//Course Roster Application<br />
#include &lt;iostream&gt;<br />
#include &quot;Address.h&quot;<br />
#include &quot;Student.h&quot;<br />
using namespace std;<br />
<br />
int menu();<br />
void enterNew(), displayStudent(), listStudents(), dispStats();<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int choice;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; do {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; choice = menu(); //get selection<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch(choice) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 1: enterNew();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 2: displayStudent();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 3: listStudents();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 4: dispStats();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case 5: break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default: cout&lt;&lt;&quot;Please try again.\n\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; } while(choice !=5);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0; <br />
}<br />
<br />
<br />
int menu() //Menu which returns a user's selection.<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int choice;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;1. Input a new roster.\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;2. Display the information of a student.\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;3. List all students registered in the class.\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;4. Display statistics.\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;5. QUIT.\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\nChoose one: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; choice;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return choice;<br />
}<br />
<br />
/*<br />
int* a = NULL;&nbsp;  // Pointer to int, initialize to nothing.<br />
int n;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  // Size needed for array<br />
cin &gt;&gt; n;&nbsp; &nbsp; &nbsp; &nbsp; // Read in the size<br />
a = new int[n];&nbsp; // Allocate n ints and save ptr in a.<br />
for (int i=0; i&lt;n; i++) {<br />
&nbsp; &nbsp; a[i] = 0;&nbsp; &nbsp; // Initialize all elements to zero.<br />
}<br />
<br />
*/<br />
void enterNew()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; system(&quot;CLS&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please enter the total number of students registered in the class: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; n;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\nThanks!\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int *arr = new int[n];<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; Student *stu;<br />
&nbsp; &nbsp; &nbsp; &nbsp; stu = new Student[n];<br />
&nbsp; &nbsp; &nbsp; &nbsp; char *name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; name = new char[30];<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\nPlease enter the information one student at a time... &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; //stu[0].setID(n);<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int i = 0; i &lt; n ; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;\nPlease enter the Student's Name: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; name;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stu[i].setName(name);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for (int j = 0; j &lt; n ; j++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;NAME: &quot; &lt;&lt; stu[j].getName() &lt;&lt; endl; //THIS IS ALL WRONG...<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; delete [] arr;<br />
&nbsp; &nbsp; &nbsp; &nbsp; delete [] stu;<br />
&nbsp; &nbsp; &nbsp; &nbsp; arr = NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; stu = NULL;<br />
}<br />
<br />
void displayStudent()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;This will display student info.\n\n&quot;;<br />
}<br />
<br />
void listStudents()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;This will list all students in a class.\n\n&quot;;<br />
}<br />
<br />
void dispStats()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;This will display average GPA, lowest GPA, and highest GPA.\n\n&quot;;<br />
}</pre><br />
I have lots of commented stuff in there just to use as possible examples and several of which that don't work that I haven't gotten to, but as this is 35% of my grade and due in less than a week, I've gotten desperate... but not desperate enough to pay someone else to do my work! hahaha<br />
<br />
What I was working on last was getting a user's input for a student's name, but it's just printing out &quot;=&quot; and so I've given up trying this by myself for the day... <br />
<br />
Any help is welcome. Thanks!</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>nguerrero03</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236107.html</guid>
		</item>
		<item>
			<title>(Beginner) Can a an example of source code??</title>
			<link>http://www.daniweb.com/forums/thread236106.html</link>
			<pubDate>Thu, 05 Nov 2009 01:31:20 GMT</pubDate>
			<description><![CDATA[i got a problem on get data from other function, 
i know can use a return... but i forgotten how to code the return.... 
can show me a example of source code ? 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a...]]></description>
			<content:encoded><![CDATA[<div>i got a problem on get data from other function,<br />
i know can use a return... but i forgotten how to code the return....<br />
can show me a example of source code ?<br />
 <pre style="margin:20px; line-height:13px">void main(){<br />
perform data()<br />
//how can i get the &quot;name&quot; from data function??<br />
}<br />
int data(){<br />
read name<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>rino699</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236106.html</guid>
		</item>
		<item>
			<title>cannot open file, no such file or directory</title>
			<link>http://www.daniweb.com/forums/thread236103.html</link>
			<pubDate>Thu, 05 Nov 2009 01:20:16 GMT</pubDate>
			<description><![CDATA[Please help, I don't know why it is not reading the file.  I am working in VS C++ 2008, I saved "input_data.txt" in the header files, see below.  What is wrong? 
 
#include <iostream> 
#include <fstream> 
#include <ctime> 
#include <cstdlib> 
#include "input_data.txt.h" 
using namespace std; 
...]]></description>
			<content:encoded><![CDATA[<div>Please help, I don't know why it is not reading the file.  I am working in VS C++ 2008, I saved &quot;input_data.txt&quot; in the header files, see below.  What is wrong?<br />
<br />
#include &lt;iostream&gt;<br />
#include &lt;fstream&gt;<br />
#include &lt;ctime&gt;<br />
#include &lt;cstdlib&gt;<br />
#include &quot;input_data.txt.h&quot;<br />
using namespace std;<br />
<br />
class Node {<br />
public:<br />
	int x;<br />
	Node *next;<br />
	Node *prev;<br />
};<br />
<br />
class periodicElement<br />
{	Node *head, *current, *prev, *tail;<br />
public:<br />
	periodicElement(){<br />
		head = current = prev = tail = NULL;<br />
	}<br />
<br />
//***** builds linked list ******//<br />
	void add(int value) {<br />
		current = new Node;<br />
		current -&gt; x = value;<br />
		current -&gt; next = NULL;<br />
		current -&gt; prev = NULL;<br />
<br />
//***** check if head equal to NULL *****//<br />
		if (head==NULL){<br />
head = current;<br />
tail = current;}<br />
		else {<br />
prev -&gt; next = current;<br />
current -&gt; prev = prev;<br />
	}<br />
tail = prev = current;<br />
	}<br />
<br />
//****** prints the linked list *****//<br />
	void printRight() {<br />
		current = head;<br />
		while (current!=NULL) {<br />
			cout &lt;&lt; current -&gt; x &lt;&lt; endl;<br />
			current = current -&gt; next;<br />
			<br />
		}<br />
	}<br />
	<br />
	void printLeft() {<br />
		current = tail;<br />
		while (current != NULL) {<br />
			cout &lt;&lt; current -&gt; x &lt;&lt; endl;<br />
			current = current -&gt; prev;<br />
		}<br />
	}<br />
	};<br />
<br />
//* an entry point for execution *//<br />
<br />
int main() {<br />
	ofstream outputFile(&quot;input_data.txt&quot;);<br />
		ifstream inputFile;<br />
		periodicElement one;<br />
		one.add(23);<br />
		one.insertNode(35);<br />
		one.add(90);<br />
		cout &lt;&lt; &quot;This prints from right to left:&quot; &lt;&lt; endl;<br />
		one.printRight();<br />
		cout &lt;&lt; endl;<br />
		cout &lt;&lt; &quot;This prints from left to right:&quot; &lt;&lt; endl;<br />
		one.printLeft();<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Gem74</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236103.html</guid>
		</item>
		<item>
			<title>how do perform multiple math operations in one single output?</title>
			<link>http://www.daniweb.com/forums/thread236101.html</link>
			<pubDate>Thu, 05 Nov 2009 01:12:38 GMT</pubDate>
			<description><![CDATA[imtrying to do a math calculation that involves multiple math operation ex((a+b)*(sin(a)/sin(b)) something like this but whenever i execute the code its giving me 3 answers this is the code hoping you could help me it very urgent though thanks!! 
 
 
  <div class="codeblock"> <div class="spaced">...]]></description>
			<content:encoded><![CDATA[<div>imtrying to do a math calculation that involves multiple math operation ex((a+b)*(sin(a)/sin(b)) something like this but whenever i execute the code its giving me 3 answers this is the code hoping you could help me it very urgent though thanks!!<br />
<br />
<br />
 <pre style="margin:20px; line-height:13px">#include &lt;iostream.h&gt;<br />
#include &lt;math.h&gt;<br />
#include &lt;string.h&gt;<br />
<br />
<br />
<br />
<br />
int nVar = 0;<br />
char varName[50];<br />
double varValue[50];<br />
<br />
double getValue(char ch);<br />
void setValue(char ch, double d);<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;This program enables the user to perform Math Functions such as fabs, sqrt, pow, log, log10, sin cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, ceil, floor, mod. Just input a character(a - z ) followed by an equal sign and the numerical value then press enter. Then in the preceding line input the function you want to use followed by a parenthesis and the alpha character then press enter. To quit, type quit then press enter:\n\n\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; 50; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; varName[i] = '(';<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; char ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; char input[6];<br />
&nbsp; &nbsp; &nbsp; &nbsp; double operand1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double operand2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double res;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;&gt;&gt;&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ch =='q'|| ch =='Q')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ch =='quit')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input[0] = ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input[1] = ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ch == '=')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; operand1;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setValue(input[0], operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; input[0] &lt;&lt; &quot;=\n\n\n\t&quot; &lt;&lt;operand1 &lt;&lt; &quot;\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch(ch)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case'+':<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = operand1 + operand2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case'-':<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = operand1 - operand2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case'*':<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = operand1 * operand2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case'/':<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = operand1 / operand2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default:<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; input[2];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int i = 3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (ch != '(')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input [i] = ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; input[i-1] = '\0';<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;sin&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = sin(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;cos&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = cos(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;tan&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = tan(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;exp&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = exp(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;log&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = log(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;pow&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand2 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = pow(operand1, operand2);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;asin&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = asin(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;acos&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = acos(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;atan&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = atan(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;fabs&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = fabs(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;sqrt&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = sqrt(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;ceil&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = ceil(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;sinh&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = sinh(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;cosh&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = cosh(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;tanh&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = tanh(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;fmod&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = fmod(operand1, operand2);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;floor&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = floor(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;log10&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = log10(operand1);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(strcmp(input, &quot;atan2&quot;) == 0)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; operand1 = getValue(ch);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res = atan2(operand1, operand2);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;ans=\n\n\n\t&quot; &lt;&lt; res &lt;&lt; &quot;\n&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}<br />
<br />
<br />
double getValue(char ch)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; nVar; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ch == varName[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return varValue[i];<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; varName[nVar] = ch;<br />
&nbsp; &nbsp; &nbsp; &nbsp; varValue[nVar] = 0.0;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; nVar++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0.0;<br />
}<br />
<br />
<br />
void setValue(char ch, double d)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt;nVar; i++)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(ch == varName[i])<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; varValue[i] = d;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>wannabeengr</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236101.html</guid>
		</item>
		<item>
			<title>Help with WndProc Mapping</title>
			<link>http://www.daniweb.com/forums/thread236100.html</link>
			<pubDate>Thu, 05 Nov 2009 01:10:52 GMT</pubDate>
			<description><![CDATA[I am trying to get a WndProc Mapping solution to work so that I can avoid just making my WndProc static.  In addition, a mapping solution is supposed to be great because I don't need to declare variables in my .cpp file, I can do it in my .h file like it should be. 
 
However, this is exactly my...]]></description>
			<content:encoded><![CDATA[<div>I am trying to get a WndProc Mapping solution to work so that I can avoid just making my WndProc static.  In addition, a mapping solution is supposed to be great because I don't need to declare variables in my .cpp file, I can do it in my .h file like it should be.<br />
<br />
However, this is exactly my problem: if you uncomment lines 3 and 4 of GameManager.cpp and you comment lines 24 and 25 of GameManager.h, the program runs just fine.  But, I need it to be the other way around!  Instead what happens is the window opens and closes abruptly.  Any insight would be greatly appreciated:<br />
<br />
*Edit: sorry if the post is too long, I'm new to these forums.  If it's too long just let me know and I'll cut out things I *think* are not causing this issue.  However, a big reason I left it is so someone can compile it (it should compile and run straight out of the box!).<br />
<br />
main.cpp:<br />
 <pre style="margin:20px; line-height:13px">#include &quot;GameManager.h&quot;&nbsp; &nbsp; &nbsp; &nbsp; // Include our GameManager and let it handle everything.<br />
#include &lt;windows.h&gt;<br />
int WINAPI WinMain(&nbsp; &nbsp; &nbsp; &nbsp; HINSTANCE&nbsp; &nbsp; &nbsp; &nbsp; hInstance,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Instance<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; HINSTANCE&nbsp; &nbsp; &nbsp; &nbsp; hPrevInstance,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Previous Instance<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LPSTR&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lpCmdLine,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Command Line Parameters<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; nCmdShow)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Show State<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; GameManager gameManager;<br />
&nbsp; &nbsp; &nbsp; &nbsp; GameManager *gm = &amp;gameManager;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return gm-&gt;run();<br />
}</pre><br />
GameManager.h:<br />
 <pre style="margin:20px; line-height:13px">#ifndef GAMEMANAGER_H<br />
#define GAMEMANAGER_H<br />
<br />
#pragma comment(lib, &quot;opengl32.lib&quot;)<br />
#pragma comment(lib, &quot;glu32.lib&quot;)<br />
<br />
#include &lt;windows.h&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Header File For Windows<br />
#include &lt;gl\gl.h&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Header File For The OpenGL32 Library<br />
#include &lt;gl\glu.h&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Header File For The GLu32 Library<br />
#include &lt;gl\glaux.h&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Header File For The Glaux Library<br />
<br />
class GameManager<br />
{<br />
public:<br />
&nbsp; &nbsp; &nbsp; &nbsp; GameManager();<br />
&nbsp; &nbsp; &nbsp; &nbsp; ~GameManager();<br />
&nbsp; &nbsp; &nbsp; &nbsp; int run();<br />
private:<br />
&nbsp; &nbsp; &nbsp; &nbsp; HDC&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hDC;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Private GDI Device Context<br />
&nbsp; &nbsp; &nbsp; &nbsp; HGLRC&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hRC;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Permanent Rendering Context<br />
&nbsp; &nbsp; &nbsp; &nbsp; HWND&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hWnd;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Holds Our Window Handle<br />
&nbsp; &nbsp; &nbsp; &nbsp; HINSTANCE&nbsp; &nbsp; &nbsp; &nbsp; hInstance;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Holds The Instance Of The Application<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp; &nbsp; &nbsp; &nbsp; keys[256];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Array Used For The Keyboard Routine<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp; &nbsp; &nbsp; &nbsp; active;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Active Flag Set To TRUE By Default<br />
//<br />
&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp; &nbsp; &nbsp; &nbsp; fullscreen;&nbsp; &nbsp; &nbsp; &nbsp; // Fullscreen Flag Set To Fullscreen Mode By Default<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; GLfloat&nbsp; &nbsp; &nbsp; &nbsp; rtri;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Angle For The Triangle ( NEW )<br />
&nbsp; &nbsp; &nbsp; &nbsp; GLfloat&nbsp; &nbsp; &nbsp; &nbsp; rquad;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Angle For The Quad ( NEW )<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; virtual LRESULT&nbsp; &nbsp; &nbsp; &nbsp; CALLBACK MsgProc(HWND, UINT, WPARAM, LPARAM);&nbsp; &nbsp; &nbsp; &nbsp; // Declaration For WndProc<br />
&nbsp; &nbsp; &nbsp; &nbsp; static LRESULT&nbsp; &nbsp; &nbsp; &nbsp; CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);&nbsp; &nbsp; &nbsp; &nbsp; // Declaration For WndProc<br />
&nbsp; &nbsp; &nbsp; &nbsp; GLvoid ReSizeGLScene(GLsizei width, GLsizei height);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int InitGL(GLvoid);<br />
&nbsp; &nbsp; &nbsp; &nbsp; int DrawGLScene(GLvoid);<br />
&nbsp; &nbsp; &nbsp; &nbsp; GLvoid KillGLWindow(GLvoid);<br />
&nbsp; &nbsp; &nbsp; &nbsp; BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag);<br />
<br />
};<br />
#endif</pre><br />
<br />
And the biggie, GameManger.cpp:<br />
 <pre style="margin:20px; line-height:13px">#include &quot;GameManager.h&quot;<br />
<br />
//&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp; &nbsp; &nbsp; &nbsp; keys[256];&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Array Used For The Keyboard Routine<br />
//&nbsp; &nbsp; &nbsp; &nbsp; bool&nbsp; &nbsp; &nbsp; &nbsp; active = true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Active Flag Set To TRUE By Default<br />
<br />
GameManager::GameManager()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; active = true;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Active Flag Set To TRUE By Default<br />
&nbsp; &nbsp; &nbsp; &nbsp; fullscreen = false;&nbsp; &nbsp; &nbsp; &nbsp; // Fullscreen Flag Set To Fullscreen Mode By Default<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; hDC=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; hRC=NULL;<br />
&nbsp; &nbsp; &nbsp; &nbsp; hWnd=NULL;<br />
}<br />
GameManager::~GameManager()<br />
{<br />
<br />
}<br />
int GameManager::run()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; MSG&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; msg;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windows Message Structure<br />
&nbsp; &nbsp; &nbsp; &nbsp; BOOL&nbsp; &nbsp; &nbsp; &nbsp; done=FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Bool Variable To Exit Loop<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; fullscreen=FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windowed Mode<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Create Our OpenGL Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!CreateGLWindow(&quot;NeHe's Rotation Tutorial&quot;,640,480,16,fullscreen))<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Quit If Window Was Not Created<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; while(!done)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Loop That Runs While done=FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (PeekMessage(&amp;msg,NULL,0,0,PM_REMOVE))&nbsp; &nbsp; &nbsp; &nbsp; // Is There A Message Waiting?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (msg.message==WM_QUIT)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Have We Received A Quit Message?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; done=TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If So done=TRUE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If Not, Deal With Window Messages<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TranslateMessage(&amp;msg);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Translate The Message<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DispatchMessage(&amp;msg);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Dispatch The Message<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If There Are No Messages<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Draw The Scene.&nbsp; Watch For ESC Key And Quit Messages From DrawGLScene()<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((active &amp;&amp; !DrawGLScene()) || keys[VK_ESCAPE])&nbsp; &nbsp; &nbsp; &nbsp; // Active?&nbsp; Was There A Quit Received?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; done=TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // ESC or DrawGLScene Signalled A Quit<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Not Time To Quit, Update Screen<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SwapBuffers(hDC);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Swap Buffers (Double Buffering)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (keys[VK_F1])&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Is F1 Being Pressed?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; keys[VK_F1]=FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If So Make Key FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Kill Our Current Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fullscreen=!fullscreen;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Toggle Fullscreen / Windowed Mode<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Recreate Our OpenGL Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!CreateGLWindow(&quot;NeHe's Rotation Tutorial&quot;,640,480,16,fullscreen))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Quit If Window Was Not Created<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Shutdown<br />
&nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Kill The Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; return (msg.wParam);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Exit The Program<br />
}<br />
<br />
GLvoid GameManager::ReSizeGLScene(GLsizei width, GLsizei height)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Resize And Initialize The GL Window<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (height==0)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Prevent A Divide By Zero By<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height=1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Making Height Equal One<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glViewport(0,0,width,height);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Current Viewport<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glMatrixMode(GL_PROJECTION);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Select The Projection Matrix<br />
&nbsp; &nbsp; &nbsp; &nbsp; glLoadIdentity();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Projection Matrix<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Calculate The Aspect Ratio Of The Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; glMatrixMode(GL_MODELVIEW);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Select The Modelview Matrix<br />
&nbsp; &nbsp; &nbsp; &nbsp; glLoadIdentity();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Modelview Matrix<br />
}<br />
<br />
int GameManager::InitGL(GLvoid)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // All Setup For OpenGL Goes Here<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; glShadeModel(GL_SMOOTH);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Enable Smooth Shading<br />
&nbsp; &nbsp; &nbsp; &nbsp; glClearColor(0.0f, 0.0f, 0.0f, 0.5f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Black Background<br />
&nbsp; &nbsp; &nbsp; &nbsp; glClearDepth(1.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Depth Buffer Setup<br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnable(GL_DEPTH_TEST);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Enables Depth Testing<br />
&nbsp; &nbsp; &nbsp; &nbsp; glDepthFunc(GL_LEQUAL);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // The Type Of Depth Testing To Do<br />
&nbsp; &nbsp; &nbsp; &nbsp; glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);&nbsp; &nbsp; &nbsp; &nbsp; // Really Nice Perspective Calculations<br />
&nbsp; &nbsp; &nbsp; &nbsp; return TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Initialization Went OK<br />
}<br />
<br />
int GameManager::DrawGLScene(GLvoid)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Here's Where We Do All The Drawing<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);&nbsp; &nbsp; &nbsp; &nbsp; // Clear Screen And Depth Buffer<br />
&nbsp; &nbsp; &nbsp; &nbsp; glLoadIdentity();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Current Modelview Matrix<br />
&nbsp; &nbsp; &nbsp; &nbsp; glTranslatef(-1.5f,0.0f,-6.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Move Left 1.5 Units And Into The Screen 6.0<br />
&nbsp; &nbsp; &nbsp; &nbsp; glRotatef(rtri,0.0f,1.0f,0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Rotate The Triangle On The Y axis ( NEW )<br />
&nbsp; &nbsp; &nbsp; &nbsp; glBegin(GL_TRIANGLES);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Start Drawing A Triangle<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glColor3f(1.0f,0.0f,0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Top Point Of Triangle To Red<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f( 0.0f, 1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // First Point Of The Triangle<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glColor3f(0.0f,1.0f,0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Left Point Of Triangle To Green<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f(-1.0f,-1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Second Point Of The Triangle<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glColor3f(0.0f,0.0f,1.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Right Point Of Triangle To Blue<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f( 1.0f,-1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Third Point Of The Triangle<br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnd();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Done Drawing The Triangle<br />
&nbsp; &nbsp; &nbsp; &nbsp; glLoadIdentity();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Current Modelview Matrix<br />
&nbsp; &nbsp; &nbsp; &nbsp; glTranslatef(1.5f,0.0f,-6.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Move Right 1.5 Units And Into The Screen 6.0<br />
&nbsp; &nbsp; &nbsp; &nbsp; glRotatef(rquad,1.0f,0.0f,0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Rotate The Quad On The X axis ( NEW )<br />
&nbsp; &nbsp; &nbsp; &nbsp; glColor3f(0.5f,0.5f,1.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set The Color To Blue One Time Only<br />
&nbsp; &nbsp; &nbsp; &nbsp; glBegin(GL_QUADS);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Draw A Quad<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f(-1.0f, 1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Top Left<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f( 1.0f, 1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Top Right<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f( 1.0f,-1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Bottom Right<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glVertex3f(-1.0f,-1.0f, 0.0f);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Bottom Left<br />
&nbsp; &nbsp; &nbsp; &nbsp; glEnd();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Done Drawing The Quad<br />
&nbsp; &nbsp; &nbsp; &nbsp; rtri+=0.2f;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Increase The Rotation Variable For The Triangle ( NEW )<br />
&nbsp; &nbsp; &nbsp; &nbsp; rquad-=0.15f;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Decrease The Rotation Variable For The Quad ( NEW )<br />
&nbsp; &nbsp; &nbsp; &nbsp; return TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Keep Going<br />
}<br />
<br />
GLvoid GameManager::KillGLWindow(GLvoid)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Properly Kill The Window<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (fullscreen)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We In Fullscreen Mode?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ChangeDisplaySettings(NULL,0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If So Switch Back To The Desktop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowCursor(TRUE);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Show Mouse Pointer<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hRC)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Do We Have A Rendering Context?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!wglMakeCurrent(NULL,NULL))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Release The DC And RC Contexts?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Release Of DC And RC Failed.&quot;,&quot;SHUTDOWN ERROR&quot;,MB_OK | MB_ICONINFORMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!wglDeleteContext(hRC))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Delete The RC?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Release Rendering Context Failed.&quot;,&quot;SHUTDOWN ERROR&quot;,MB_OK | MB_ICONINFORMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hRC=NULL;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set RC To NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hDC &amp;&amp; !ReleaseDC(hWnd,hDC))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Release The DC<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Release Device Context Failed.&quot;,&quot;SHUTDOWN ERROR&quot;,MB_OK | MB_ICONINFORMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hDC=NULL;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set DC To NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (hWnd &amp;&amp; !DestroyWindow(hWnd))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Destroy The Window?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Could Not Release hWnd.&quot;,&quot;SHUTDOWN ERROR&quot;,MB_OK | MB_ICONINFORMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hWnd=NULL;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set hWnd To NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!UnregisterClass(&quot;OpenGL&quot;,hInstance))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Unregister Class<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Could Not Unregister Class.&quot;,&quot;SHUTDOWN ERROR&quot;,MB_OK | MB_ICONINFORMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hInstance=NULL;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set hInstance To NULL<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
}<br />
<br />
/*&nbsp; &nbsp; &nbsp; &nbsp; This Code Creates Our OpenGL Window.&nbsp; Parameters Are:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; title&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - Title To Appear At The Top Of The Window&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; width&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - Width Of The GL Window Or Fullscreen Mode&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; height&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - Height Of The GL Window Or Fullscreen Mode&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; bits&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - Number Of Bits To Use For Color (8/16/24/32)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; *<br />
&nbsp;*&nbsp; &nbsp; &nbsp; &nbsp; fullscreenflag&nbsp; &nbsp; &nbsp; &nbsp; - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE)&nbsp; &nbsp; &nbsp; &nbsp; */<br />
&nbsp;<br />
BOOL GameManager::CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; GLuint&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PixelFormat;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Holds The Results After Searching For A Match<br />
&nbsp; &nbsp; &nbsp; &nbsp; WNDCLASS&nbsp; &nbsp; &nbsp; &nbsp; wc;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windows Class Structure<br />
&nbsp; &nbsp; &nbsp; &nbsp; DWORD&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwExStyle;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Extended Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; DWORD&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwStyle;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; RECT&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WindowRect;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Grabs Rectangle Upper Left / Lower Right Values<br />
&nbsp; &nbsp; &nbsp; &nbsp; WindowRect.left=(long)0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Left Value To 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; WindowRect.right=(long)width;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Right Value To Requested Width<br />
&nbsp; &nbsp; &nbsp; &nbsp; WindowRect.top=(long)0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Top Value To 0<br />
&nbsp; &nbsp; &nbsp; &nbsp; WindowRect.bottom=(long)height;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Bottom Value To Requested Height<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; fullscreen=fullscreenflag;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set The Global Fullscreen Flag<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; hInstance&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = GetModuleHandle(NULL);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Grab An Instance For Our Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.style&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;&nbsp; &nbsp; &nbsp; &nbsp; // Redraw On Size, And Own DC For Window.<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.lpfnWndProc&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = (WNDPROC) WndProc;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // WndProc Handles Messages<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.cbClsExtra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Extra Window Data<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.cbWndExtra&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = 0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Extra Window Data<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.hInstance&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = hInstance;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set The Instance<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.hIcon&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = LoadIcon(NULL, IDI_WINLOGO);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Load The Default Icon<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.hCursor&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = LoadCursor(NULL, IDC_ARROW);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Load The Arrow Pointer<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.hbrBackground&nbsp; &nbsp; &nbsp; &nbsp; = NULL;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Background Required For GL<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.lpszMenuName&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = NULL;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // We Don't Want A Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; wc.lpszClassName&nbsp; &nbsp; &nbsp; &nbsp; = &quot;OpenGL&quot;;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set The Class Name<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!RegisterClass(&amp;wc))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Attempt To Register The Window Class<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Failed To Register The Window Class.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (fullscreen)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Attempt Fullscreen Mode?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DEVMODE dmScreenSettings;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Device Mode<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; memset(&amp;dmScreenSettings,0,sizeof(dmScreenSettings));&nbsp; &nbsp; &nbsp; &nbsp; // Makes Sure Memory's Cleared<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dmScreenSettings.dmSize=sizeof(dmScreenSettings);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Size Of The Devmode Structure<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dmScreenSettings.dmPelsWidth&nbsp; &nbsp; &nbsp; &nbsp; = width;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selected Screen Width<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dmScreenSettings.dmPelsHeight&nbsp; &nbsp; &nbsp; &nbsp; = height;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selected Screen Height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dmScreenSettings.dmBitsPerPel&nbsp; &nbsp; &nbsp; &nbsp; = bits;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Selected Bits Per Pixel<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Try To Set Selected Mode And Get Results.&nbsp; NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (ChangeDisplaySettings(&amp;dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If The Mode Fails, Offer Two Options.&nbsp; Quit Or Use Windowed Mode.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (MessageBox(NULL,&quot;The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?&quot;,&quot;NeHe GL&quot;,MB_YESNO|MB_ICONEXCLAMATION)==IDYES)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fullscreen=FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windowed Mode Selected.&nbsp; Fullscreen = FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Pop Up A Message Box Letting User Know The Program Is Closing.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Program Will Now Close.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONSTOP);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (fullscreen)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Still In Fullscreen Mode?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwExStyle=WS_EX_APPWINDOW;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Extended Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwStyle=WS_POPUP;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windows Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ShowCursor(FALSE);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Hide Mouse Pointer<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Extended Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwStyle=WS_OVERLAPPEDWINDOW;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Windows Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; AdjustWindowRectEx(&amp;WindowRect, dwStyle, FALSE, dwExStyle);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Adjust Window To True Requested Size<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Create The Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!(hWnd=CreateWindowEx(&nbsp; &nbsp; &nbsp; &nbsp; dwExStyle,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Extended Style For The Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;OpenGL&quot;,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Class Name<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Title<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dwStyle |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Defined Window Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WS_CLIPSIBLINGS |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Required Window Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WS_CLIPCHILDREN,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Required Window Style<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Window Position<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WindowRect.right-WindowRect.left,&nbsp; &nbsp; &nbsp; &nbsp; // Calculate Window Width<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WindowRect.bottom-WindowRect.top,&nbsp; &nbsp; &nbsp; &nbsp; // Calculate Window Height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NULL,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Parent Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NULL,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Menu<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hInstance,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Instance<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NULL)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Dont Pass Anything To WM_CREATE<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Window Creation Error.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; static&nbsp; &nbsp; &nbsp; &nbsp; PIXELFORMATDESCRIPTOR pfd=&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // pfd Tells Windows How We Want Things To Be<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sizeof(PIXELFORMATDESCRIPTOR),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Size Of This Pixel Format Descriptor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Version Number<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PFD_DRAW_TO_WINDOW |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Format Must Support Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PFD_SUPPORT_OPENGL |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Format Must Support OpenGL<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PFD_DOUBLEBUFFER,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Must Support Double Buffering<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PFD_TYPE_RGBA,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Request An RGBA Format<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; bits,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Select Our Color Depth<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, 0, 0, 0, 0, 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Color Bits Ignored<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Alpha Buffer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Shift Bit Ignored<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Accumulation Buffer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, 0, 0, 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Accumulation Bits Ignored<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 16,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 16Bit Z-Buffer (Depth Buffer)&nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Stencil Buffer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // No Auxiliary Buffer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PFD_MAIN_PLANE,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Main Drawing Layer<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reserved<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0, 0, 0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Layer Masks Ignored<br />
&nbsp; &nbsp; &nbsp; &nbsp; };<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!(hDC=GetDC(hWnd)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Did We Get A Device Context?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Can't Create A GL Device Context.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!(PixelFormat=ChoosePixelFormat(hDC,&amp;pfd)))&nbsp; &nbsp; &nbsp; &nbsp; // Did Windows Find A Matching Pixel Format?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Can't Find A Suitable PixelFormat.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!SetPixelFormat(hDC,PixelFormat,&amp;pfd))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Set The Pixel Format?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Can't Set The PixelFormat.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!(hRC=wglCreateContext(hDC)))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Are We Able To Get A Rendering Context?<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Can't Create A GL Rendering Context.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!wglMakeCurrent(hDC,hRC))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Try To Activate The Rendering Context<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Can't Activate The GL Rendering Context.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; SetWindowLongPtr(hWnd, GWLP_USERDATA, (long)this);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; ShowWindow(hWnd,SW_SHOW);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Show The Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; UpdateWindow(hWnd);<br />
&nbsp; &nbsp; &nbsp; &nbsp; SetForegroundWindow(hWnd);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Slightly Higher Priority<br />
&nbsp; &nbsp; &nbsp; &nbsp; SetFocus(hWnd);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Sets Keyboard Focus To The Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; ReSizeGLScene(width, height);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Set Up Our Perspective GL Screen<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (!InitGL())&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Initialize Our Newly Created GL Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; KillGLWindow();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Reset The Display<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageBox(NULL,&quot;Initialization Failed.&quot;,&quot;ERROR&quot;,MB_OK|MB_ICONEXCLAMATION);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Success<br />
}<br />
<br />
LRESULT CALLBACK GameManager::MsgProc(&nbsp; &nbsp; &nbsp; &nbsp; HWND&nbsp; &nbsp; &nbsp; &nbsp; hWnd,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Handle For This Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UINT&nbsp; &nbsp; &nbsp; &nbsp; uMsg,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Message For This Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WPARAM&nbsp; &nbsp; &nbsp; &nbsp; wParam,&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Additional Message Information<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LPARAM&nbsp; &nbsp; &nbsp; &nbsp; lParam)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Additional Message Information<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; switch (uMsg)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Check For Windows Messages<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case WM_ACTIVATE:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Watch For Window Activate Message<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!HIWORD(wParam))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Check Minimization State<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active=TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Program Is Active<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; active=FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Program Is No Longer Active<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Return To The Message Loop<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case WM_SYSCOMMAND:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Intercept System Commands<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; switch (wParam)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Check System Calls<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case SC_SCREENSAVE:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Screensaver Trying To Start?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case SC_MONITORPOWER:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Monitor Trying To Enter Powersave?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Prevent From Happening<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; break;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Exit<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case WM_CLOSE:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Did We Receive A Close Message?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PostQuitMessage(0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Send A Quit Message<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Jump Back<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case WM_KEYDOWN:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Is A Key Being Held Down?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; keys[wParam] = TRUE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If So, Mark It As TRUE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Jump Back<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case WM_KEYUP:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Has A Key Been Released?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; keys[wParam] = FALSE;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // If So, Mark It As FALSE<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Jump Back<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; case WM_SIZE:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Resize The OpenGL Window<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
//&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ReSizeGLScene(LOWORD(lParam),HIWORD(lParam));&nbsp; // LoWord=Width, HiWord=Height<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return 1;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Jump Back<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Pass All Unhandled Messages To DefWindowProc<br />
&nbsp; &nbsp; &nbsp; &nbsp; return DefWindowProc(hWnd,uMsg,wParam,lParam);<br />
}<br />
<br />
<br />
LRESULT CALLBACK GameManager::WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {&nbsp; &nbsp; <br />
&nbsp; &nbsp; // Recover the pointer to our class, don't forget to type cast it back<br />
<br />
&nbsp; &nbsp; GameManager* winptr = (GameManager*)GetWindowLongPtr(hwnd, GWLP_USERDATA);<br />
&nbsp; &nbsp; // Check if the pointer is NULL and call the Default WndProc<br />
<br />
&nbsp; &nbsp; if (winptr == NULL)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return DefWindowProc(hwnd, message, wParam, lParam);<br />
&nbsp; &nbsp; } else<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // Call the Message Handler for my class (MsgProc in my case)<br />
&nbsp; &nbsp; &nbsp; &nbsp; return winptr-&gt;MsgProc(hwnd, message, wParam, lParam); <br />
&nbsp; &nbsp; }<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>dalcocer</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236100.html</guid>
		</item>
		<item>
			<title>Functions</title>
			<link>http://www.daniweb.com/forums/thread236090.html</link>
			<pubDate>Wed, 04 Nov 2009 23:54:20 GMT</pubDate>
			<description><![CDATA[I am trying to figure out why my function isn't working when I compile the program....can anyone suggest anything? 
 
  <div class="codeblock"> <div class="spaced"> <div style="float:right; margin-right:10px"> <a href="/forums/misc.php?do=explaincode&amp;TB_iframe=true&amp;height=400&amp;width=680"...]]></description>
			<content:encoded><![CDATA[<div>I am trying to figure out why my function isn't working when I compile the program....can anyone suggest anything?<br />
<br />
 <pre style="margin:20px; line-height:13px"><br />
#include &lt;iostream&gt;<br />
#include &lt;cmath&gt;<br />
using namespace std;<br />
<br />
double distance();<br />
<br />
void main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double center1, center2, point1, point2;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter X-Value of Center: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; center1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter Y-Value of Center: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; center2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter X-Value of Point: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; point1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Please Enter Y-Value of Point: &quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cin &gt;&gt; point2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Distance between points: &quot; &lt;&lt; distance();<br />
&nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
<br />
} //End of Main<br />
<br />
double distance()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; double center1, center2, point1, point2;<br />
&nbsp; &nbsp; &nbsp; &nbsp; double distance1, distance2, distance3;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (point1 &gt;= center1 &amp;&amp; point2 &gt;= center2 )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; distance1 = (point1 - center1); <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; distance2 = (point2 - center2);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; distance3 = pow((distance1 + distance2), (1/2));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Distance Between Points: &quot; &lt;&lt; distance3;<br />
&nbsp; &nbsp; &nbsp; &nbsp; else<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Points Will Produce an Unreal Number&quot;; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt;endl;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return distance3;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>PDB1982</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236090.html</guid>
		</item>
		<item>
			<title>Coin simulate</title>
			<link>http://www.daniweb.com/forums/thread236088.html</link>
			<pubDate>Wed, 04 Nov 2009 23:53:52 GMT</pubDate>
			<description><![CDATA[Hey i was trying to do a coin simulate that tells you how many heads / tails it appears and that every time heads pops up you gain $2.00 (win) and whenever tails pops up (lose) you lose $1.00. My program does not print the winnings i do not know why. Thanks 
 
#include <iostream> 
using...]]></description>
			<content:encoded><![CDATA[<div>Hey i was trying to do a coin simulate that tells you how many heads / tails it appears and that every time heads pops up you gain $2.00 (win) and whenever tails pops up (lose) you lose $1.00. My program does not print the winnings i do not know why. Thanks<br />
<br />
#include &lt;iostream&gt;<br />
using namespace:std;<br />
<br />
#include &lt;iomanip&gt;<br />
using std: setprecision;<br />
<br />
#include &lt;cstdlib&gt;<br />
<br />
#include &lt;ctime&gt;<br />
<br />
int main()<br />
{<br />
	double heads = 0;<br />
	double tails = 0;<br />
	int coin;<br />
	<br />
	srand (time(0) );<br />
<br />
	for (int flip = 1; flip &lt;= 10; flip++) {<br />
		coin = 1 +rand()%2;<br />
<br />
		switch (coin) {<br />
			case 1:<br />
				++heads;<br />
				break;<br />
<br />
			case 2:<br />
				++tails;<br />
				break;<br />
<br />
			default:<br />
				cout &lt;&lt;&quot;?&quot;;<br />
		}<br />
	}<br />
	cout &lt;&lt;&quot;Heads was flipped &quot;&lt;&lt;heads&lt;&lt;&quot; times&quot;&lt;&lt;endl;<br />
	cout &lt;&lt;&quot;Tails was flipped &quot;&lt;&lt;tails&lt;&lt;&quot; times\n&quot;&lt;&lt;endl;<br />
<br />
<br />
	return 0;<br />
}<br />
<br />
void calculateTotal(double heads, double tails)<br />
{<br />
	double win = heads * 2;<br />
	double lose = tails * 1;<br />
	double total = heads - tails;<br />
<br />
	if (total &gt; 0)<br />
		cout &lt;&lt;&quot;Congratulations you have won $ &quot;&lt;&lt;total&lt;&lt;endl;<br />
	else<br />
		cout &lt;&lt;&quot;Sorry you lost&quot;&lt;&lt;endl;<br />
	<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Mclovin1234</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236088.html</guid>
		</item>
		<item>
			<title>Internet Provider Switch Program Help</title>
			<link>http://www.daniweb.com/forums/thread236072.html</link>
			<pubDate>Wed, 04 Nov 2009 22:40:11 GMT</pubDate>
			<description><![CDATA[I am very new to C++ and have the slightest  idea where to start.  Here are the directions for the project I'm doing.  Below is a copy of the program that I have so far. 
 
An internet service provider has three different subscription packages for its customers: 
Package A:  For $9.95 per month 10...]]></description>
			<content:encoded><![CDATA[<div>I am very new to C++ and have the slightest  idea where to start.  Here are the directions for the project I'm doing.  Below is a copy of the program that I have so far.<br />
<br />
An internet service provider has three different subscription packages for its customers:<br />
Package A:  For $9.95 per month 10 hours of access are provided. Additional hours are $2.00 per hour for 11-19 hours, $3.00 per hour for 20-50 hours and $4.00 per hour 51 or greater hours with maximum of 744 hours<br />
Package B.  For $14.95 per month 20 hours of access are provided. Additional hours are $1.00 per hour for 11-30 hours, $3.00 per hour for 31-75 hours and $4.00 per hour 76 or greater hours with maximum of 744 hours<br />
Package C.  For $19.95 per month unlimited access is provided.<br />
Write a program that displays the menu above and use a switch case to calculate a customer’s monthly bill. The program will ask which package the customer has purchased and how many hours were used. It should then display the total amount due.<br />
Input Validation: If user enters negative hours or enters a value other than A, B or C the program should display an error message and exit the program. If number of hours used in a month is greater than 744, display a message that the number hours used in a month cannot exceed 744. <br />
<br />
<br />
#include &lt;iostream&gt;<br />
<br />
using namespace std;<br />
<br />
<br />
<br />
int main()<br />
{<br />
	//declare constants and variables<br />
	double packageA = $9.95;<br />
	double packageB = $14.95;<br />
	double packageC = $19.95;<br />
	char pkg = ' ';<br />
<br />
<br />
	//enter input data<br />
    cout&lt;&lt;&quot;Enter pkg: &quot;;<br />
    cin&gt;&gt;pkg;<br />
	pkg = toupper(pkg);<br />
<br />
    if( pkg==A || pkg==B || pkg==C)<br />
    {<br />
        int hrs;<br />
        cout&lt;&lt;&quot;Enter hours: &quot;;<br />
        cin&gt;&gt;hrs;<br />
<br />
        if(hrs&gt;=0 &amp;&amp; hrs&lt;=744)<br />
        {<br />
            int chg;<br />
            &lt;strong class=&quot;highlight&quot;&gt;switch&lt;/strong&gt;(pkg)<br />
            {<br />
	case A:<br />
	     chg = 9.95 + ( (hrs&gt;10) ? (hrs-10)*2 : 0 );<br />
                    break;<br />
<br />
                case:<br />
	     {<br />
		if (hrs&lt;=20)<br />
		     chg= 14.95;<br />
		else if (hrs&gt;20 &amp;&amp; hrs &lt;=50)<br />
		     chg= 18+( (hrs&gt;20 &amp;&amp; hrs&lt;=51) ? (hrs-20)*3 : 0 );<br />
				<br />
		else if (hrs&gt;51)<br />
		     chg= 19.95;<br />
					<br />
                                break;							    }<br />
				case:<br />
					&lt;strong class=&quot;highlight&quot;&gt;3&lt;/strong&gt;:<br />
                      {<br />
	       if (hrs&lt;=200)<br />
		{<br />
		chg=25;<br />
		}<br />
	       else if (hrs&gt;200 &amp;&amp; hrs&lt;=450)<br />
		{<br />
		chg=35;<br />
		}<br />
	       else if (hrs&gt;450)<br />
		{<br />
		chg=50;<br />
		}<br />
	       break;<br />
	       }<br />
<br />
                default: <br />
                    break; <br />
            }<br />
<br />
            cout&lt;&lt;&quot;charges: &quot;&lt;&lt;chg&lt;&lt;endl;<br />
        }<br />
        else<br />
        <br />
            cout&lt;&lt;&quot;Invalid hrs&quot;&lt;&lt;endl;<br />
        <br />
<br />
    }<br />
    else<br />
    {<br />
        cout&lt;&lt;&quot;Invalid pkg&quot;&lt;&lt;endl;<br />
    }<br />
<br />
<br />
<br />
<br />
<br />
}//end main</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>vinochick</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236072.html</guid>
		</item>
		<item>
			<title>Accessing vector elements</title>
			<link>http://www.daniweb.com/forums/thread236069.html</link>
			<pubDate>Wed, 04 Nov 2009 22:30:54 GMT</pubDate>
			<description><![CDATA[I have a 2D vector of different values. It could be text or numbers. 
 
I need to be able to see what is in the vector and to do something depending on what is in there. 
 
How do i access each element of the vector and add to a temp string variable so i can make a comparison? 
  <div...]]></description>
			<content:encoded><![CDATA[<div>I have a 2D vector of different values. It could be text or numbers.<br />
<br />
I need to be able to see what is in the vector and to do something depending on what is in there.<br />
<br />
How do i access each element of the vector and add to a temp string variable so i can make a comparison?<br />
 <pre style="margin:20px; line-height:13px">Here is my code so far<br />
#include &lt;fstream&gt;<br />
#include &lt;iostream&gt;<br />
#include &lt;vector&gt;<br />
#include &lt;cstring&gt;<br />
#include &lt;string&gt;<br />
#include &lt;sstream&gt;<br />
#include &lt;stdio.h&gt;<br />
<br />
using namespace std;<br />
<br />
/* function to split token with punctuation into seperate tokens<br />
&nbsp;* if no punctuation is found the whole string goes into a token<br />
&nbsp;* function also splits double punctuation into tokens so )) would<br />
&nbsp;* each have it's own token<br />
&nbsp;*/<br />
std::vector&lt;std::string&gt; SplitOnPunct(std::string const&amp; str,std::string const&amp; punct )<br />
{<br />
&nbsp; &nbsp; std::vector&lt;std::string&gt; vec;<br />
<br />
&nbsp; &nbsp; if (str.length() == 0) return vec;<br />
<br />
&nbsp; &nbsp; std::string::size_type pos, end;<br />
<br />
&nbsp; &nbsp; for (pos = 0; pos != std::string::npos; pos = end)<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; end = str.find_first_of(punct, pos);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (end == pos &amp;&amp; ++end == str.size()) end = std::string::npos;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; vec.push_back(str.substr(pos, end - pos));<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; return vec;<br />
}<br />
<br />
int main()<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; int i;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int a=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string line;<br />
&nbsp; &nbsp; &nbsp; &nbsp; int b=0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; string Line=&quot;Line&quot;;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ifstream myFile(&quot;scan.cm&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; if (! myFile)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Error opening output fle&quot;&nbsp; &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return -1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; vector &lt; vector &lt; string &gt; &gt; info;<br />
&nbsp; &nbsp; &nbsp; &nbsp; vector &lt; string &gt; data;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; while( getline( myFile, line ) )<br />
&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vector &lt; string &gt; data;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string value;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; istringstream iss(line);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::ostringstream p;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add a line number as the first token<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; b++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p &lt;&lt; &quot;Line: &quot; &lt;&lt; b;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.push_back(p.str());<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (iss &gt;&gt; value)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //check if the current line is a comment<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(line[0] =='/' &amp;&amp; line[1] == '*')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(line[0] =='*')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if(line[0] =='*' &amp;&amp; line[1] == '/')<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //check if the rest of the line is a comment&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned int pos = line.find(&quot;//&quot;, 0 );<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(pos !=string::npos)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //split and token with punctuation into further tokens<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vector&lt;string&gt; vec = SplitOnPunct(value, &quot;+-*/&lt;=!&gt;{()};,&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add each token to the inner vector<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (std::vector&lt;std::string&gt;::size_type a = 0; a &lt; vec.size(); ++a)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; data.push_back(vec.at(a));<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //add the tokens to the out vector<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info.push_back(data);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; for ( vector&lt; vector&lt; string &gt; &gt; :: size_type i = 0, size = info.size(); i &lt; size; ++i)<br />
&nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for ( vector &lt; string &gt; :: size_type j = 0, length = info[i].size(); j &lt; length; ++j)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //check to see if the inner vectors are empty<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(info[i].size() &gt; 1)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //this is where I need to access the vector<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; info[i][j] &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; endl;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; myFile.close();<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />
}</pre></div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>AdRock</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236069.html</guid>
		</item>
		<item>
			<title>class triangle in c++</title>
			<link>http://www.daniweb.com/forums/thread236066.html</link>
			<pubDate>Wed, 04 Nov 2009 22:10:15 GMT</pubDate>
			<description>Hello,help me to make class in c++</description>
			<content:encoded><![CDATA[<div>Hello,help me to make class in c++</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Nika01</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236066.html</guid>
		</item>
		<item>
			<title>balancing in search tree in c++</title>
			<link>http://www.daniweb.com/forums/thread236065.html</link>
			<pubDate>Wed, 04 Nov 2009 22:06:59 GMT</pubDate>
			<description><![CDATA[Helllo,,please,help me,to write programm add balance,delete balance in search tree, 
TreeNode *AddBalance (Type x,TreeNode *root,int *grow) 
{int  incr; 
 *grow = 0; 
 if (!root) 
 {root=(TreeNode*) GetPlace(); 
  if (root) 
  {root->left=root->right=0; 
   root->value=x; root->balance=0; 
  ...]]></description>
			<content:encoded><![CDATA[<div>Helllo,,please,help me,to write programm add balance,delete balance in search tree,<br />
TreeNode *AddBalance (Type x,TreeNode *root,int *grow)<br />
{int  incr;<br />
 *grow = 0;<br />
 if (!root)<br />
 {root=(TreeNode*) GetPlace();<br />
  if (root)<br />
  {root-&gt;left=root-&gt;right=0;<br />
   root-&gt;value=x; root-&gt;balance=0;<br />
   *grow=1;<br />
  }<br />
   return root;<br />
  }<br />
  if (x&lt;=root-&gt;value)<br />
    {root-&gt;left=AddBalance(x,root-&gt;left,&amp;incr);<br />
     if (incr)<br />
       {switch(root-&gt;balance)<br />
          {case  0:root-&gt;balance=-1;*grow=1;break;<br />
           case  1:root-&gt;balance=0;break;<br />
           case -1:<br />
              switch(root-&gt;left-&gt;balance)<br />
                {case -1:root=Rebuild_L1(root);break;<br />
                 case  1:root=Rebuild_L2(root);<br />
              }<br />
        }<br />
     }<br />
}<br />
 else {root-&gt;right=AddBalance(x,root-&gt;right,&amp;incr);<br />
       if(incr)<br />
        {switch(root-&gt;balance)<br />
           {case  0:root-&gt;balance=-1;*grow=1;break;<br />
            case -1:root-&gt;balance=0;break;<br />
            case  1:<br />
               switch(root-&gt;right-&gt;balance)<br />
                 {case  1:root=Rebuild_L1(root);break;<br />
                  case -1:root=Rebuild_L2(root);<br />
<br />
               } <br />
         } <br />
                 }<br />
<br />
        }<br />
         return root;<br />
}</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>Nika01</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236065.html</guid>
		</item>
		<item>
			<title>How to insert data in CLOB column</title>
			<link>http://www.daniweb.com/forums/thread236057.html</link>
			<pubDate>Wed, 04 Nov 2009 21:24:23 GMT</pubDate>
			<description><![CDATA[Hi , 
 
I am trying to insert data into a CLOB column, but I get error of missing comma because my CLOB data value has lot's of comma and other special characters which might need to be escaped. Is there a easier way to do this, without writing code to put escape character before all special...]]></description>
			<content:encoded><![CDATA[<div>Hi ,<br />
<br />
I am trying to insert data into a CLOB column, but I get error of missing comma because my CLOB data value has lot's of comma and other special characters which might need to be escaped. Is there a easier way to do this, without writing code to put escape character before all special characters in CLOB data value.<br />
<br />
sStatement.Format(_T(&quot;INSERT INTO rktable (rk_clob_col) values (%s),rk_str));<br />
<br />
Thanks in advance.<br />
<br />
Rohan</div> ]]></content:encoded>
			<category domain="http://www.daniweb.com/forums/forum8.html">C++</category>
			<dc:creator>rohank23</dc:creator>
			<guid isPermaLink="true">http://www.daniweb.com/forums/thread236057.html</guid>
		</item>
		<item>
			<title>Troubleshooting Segmentation Fault Involving Pointer</title>
			<link>http://www.daniweb.com/forums/thread236054.html</link>
			<pubDate>Wed, 04 Nov 2009 20:41:24 GMT</pubDate>
			<description><![CDATA[Or at least I think that's the issue. Essentially, I am in the process of overloading operators and allowing users to enter data directly into the class objects. I was able to do the first one so I followed the same pattern and I get a segmentation fault when I try to cin >> the information....]]></description>
			<content:encoded><![CDATA[<div>Or at least I <span style="font-style:italic">think </span>that's the issue. Essentially, I am in the process of overloading operators and allowing users to enter data directly into the class objects. I was able to do the first one so I followed the same pattern and I get a segmentation fault when I try to cin &gt;&gt; the information. Everything else about the program operates as it should, so I'll post what I think are the relevant pieces of code:<br />
<br />
appointment.h:<br />
 <pre style="margin:20px; line-height:13px">class Appointment<br />
{<br />
&nbsp; Time startTime;<br />
&nbsp; Time endTime;<br />
&nbsp; char *subject;<br />
&nbsp; char *location;<br />
&nbsp; friend ostream &amp;operator&lt;&lt;( ostream &amp;, const Appointment &amp; );<br />
&nbsp; friend istream &amp;operator&gt;&gt;( istream &amp;, Appointment &amp; );<br />
public:<br />
&nbsp; Appointment();<br />
&nbsp; Appointment(const char* subject);<br />
&nbsp; ~Appointment();<br />
&nbsp; void read();<br />
&nbsp; Appointment&amp; operator= (const Appointment &amp;a);<br />
&nbsp; bool operator== (const char *s) const;<br />
&nbsp; void makeAppt();<br />
}; // class Appointment</pre><br />
appointment.cpp:<br />
 <pre style="margin:20px; line-height:13px">void Appointment::makeAppt()<br />
{<br />
&nbsp; &nbsp; cout &lt;&lt; &quot;Subject