<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>array of string problem</title>
		<link>http://www.allegro.cc/forums/view/561804</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 25 Jan 2006 18:53:52 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>i use c language.<br />i have one array of string and one char variable and i want to compare they value is same or not ,so wat should i do .<br />math_q1 is the question arrays.<br />The math_a1 store the answers of the question example 2 + 3 = <br />the multiple choice is 1 : 7,  2 : 6,  3 : 5 the 4 th row store the right answers position.</p><p>get the key input 1 or 2 or 3 from user <br />compare the value key in with the 4 th row of array; <br />char *math_q1 [5]  = {&quot;2 + 3 = &quot;,&quot;6 + 7 = &quot;,&quot;2 + 8 = &quot;,&quot;7 + 10 = &quot;,&quot;9 + 12 = &quot;}<br />char *math_a1 [4][5]  = {<br />		       {&quot;7&quot;,&quot;15&quot;,&quot;8&quot;,&quot;17&quot;,&quot;21&quot;},<br />							                 {&quot;6&quot;,&quot;14&quot;,&quot;10&quot;,&quot;15&quot;,&quot;22&quot;},<br />							                 {&quot;5&quot;,&quot;13&quot;,&quot;13&quot;,&quot;13&quot;,&quot;23&quot;},<br />							                 {&quot;3&quot;,&quot;3&quot;,&quot;2&quot;,&quot;1&quot;,&quot;1&quot;}<br />                         }<br />char answers = ureadkey(NULL); <br />if(answers == math_a1[4][1])<br />{......}<br />but problem is answers is char and math_al is array of string<br />i am doing a quiz game ,is this good way to do this ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (chin jiunn gai)</author>
		<pubDate>Wed, 25 Jan 2006 17:55:24 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;d store integers in the table and use atoi to convert the user input to an interger.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fladimir da Gorf)</author>
		<pubDate>Wed, 25 Jan 2006 18:01:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I really didn&#39;t understand what you want to do... but in any case Fladimir&#39;s tip should do it <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /><br />BTW:
</p><div class="quote_container"><div class="title">Fladimir da Gorf&#39;s sig said:</div><div class="quote"><p>

The final testing of OpenLayer 2.0 is underway! (Yet another Framebuffer issue solved)
</p></div></div><p>
Considering you&#39;re changing your sig very instensely, I guess OpenLayer 2.0 is just getting the last hits on the anvil? <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Pedro Avelar Gontijo)</author>
		<pubDate>Wed, 25 Jan 2006 18:09:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>my question not only integer but string ,example which is the longest rivers<br />1 :xx  <br />2 :xx<br />3 :xx
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (chin jiunn gai)</author>
		<pubDate>Wed, 25 Jan 2006 18:18:37 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Then use strcmp instead of the == operator to test the equality of strings. If you want to get really fancy you could also ignore case and strip the trailing and leading spaces from the input etc.
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Considering you&#39;re changing your sig very instensely, I guess OpenLayer 2.0 is just getting the last hits on the anvil?
</p></div></div><p>
Maybe <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /> I&#39;ll just have to solve a color issue with the framebuffers (probably caused by the way that AllegroGL uploads the textures) and a few other things.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fladimir da Gorf)</author>
		<pubDate>Wed, 25 Jan 2006 18:23:39 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>so how what code i should write to convert my input to string ? i am use the allegro for the input .and my input either 1,2 or 3 only<br />or u comment me step how to do quiz game ?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (chin jiunn gai)</author>
		<pubDate>Wed, 25 Jan 2006 18:31:27 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>The best way would be to use a real GUI. But if you want to do it by yourself here&#39;s a <a href="http://awiki.tomasu.org/bin/view/Main/TextInputC">quick article</a> about it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fladimir da Gorf)</author>
		<pubDate>Wed, 25 Jan 2006 18:36:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>that article just for text input . <br /> i can get input from user and i am using gui , i just dont write the code inside here .i just show u the problem part . <br />as u say use strcmp but the input is char type <br />so how to convert the answers to string <br />sorry for this ,i really newbiz in programming . </p><p>and i want to ask is this the way to do the quiz game . </p><p>store the question and answers in array then compare the user input with store answers ... is that something i omit
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (chin jiunn gai)</author>
		<pubDate>Wed, 25 Jan 2006 18:47:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>You&#39;re reading only one key, not a string. But as you have predefined choises to choose from, that&#39;s enough. To convert a char to a string you could use the age old trick:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">char</span> <span class="k3">*</span>answer<span class="k2">[</span><span class="n">2</span><span class="k2">]</span><span class="k2">;</span>
answer<span class="k2">[</span><span class="n">0</span><span class="k2">]</span> <span class="k3">=</span> <a href="http://www.allegro.cc/manual/ureadkey" target="_blank"><span class="a">ureadkey</span></a><span class="k2">(</span>NULL<span class="k2">)</span><span class="k2">;</span>
answer<span class="k2">[</span><span class="n">1</span><span class="k2">]</span> <span class="k3">=</span> <span class="s">'\0'</span><span class="k2">;</span>

<span class="c">// Or if you want you could also use sprintf:</span>
<a href="http://www.delorie.com/djgpp/doc/libc/libc_737.html" target="_blank">sprintf</a><span class="k2">(</span> answer, <span class="s">"%c"</span>, <a href="http://www.allegro.cc/manual/ureadkey" target="_blank"><span class="a">ureadkey</span></a><span class="k2">(</span> NULL <span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Fladimir da Gorf)</author>
		<pubDate>Wed, 25 Jan 2006 18:53:52 +0000</pubDate>
	</item>
</rss>
