<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>i need arrays boss @_@ - C++ - tribe.net</title>
    <link>http://cpp.tribe.net/thread/de3648bc-4501-41a2-af05-a757fae9ea14?format=rss</link>
    <description>Tribe.net. Local Connections</description>
    <item>
      <title>Re: i need arrays boss @_@</title>
      <link>http://CPP.tribe.net/thread/de3648bc-4501-41a2-af05-a757fae9ea14#c7aedded-0a94-41e6-b21a-bdb0421ccb82</link>
      <description>You don't mention what the linker error is so it's hard to guess.  Likely, you either typo'd a name or forgot to link with a lib.&#xD;
&#xD;
Just glancing at your file, there's no safety from running off the end of the array, like stopping input after 10 items or insuring strings are large enough to support what ever is typed in.</description>
      <pubDate>Wed, 29 Jun 2005 02:54:24 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/de3648bc-4501-41a2-af05-a757fae9ea14#c7aedded-0a94-41e6-b21a-bdb0421ccb82</guid>
      <dc:creator>Hypno</dc:creator>
      <dc:date>2005-06-29T02:54:24Z</dc:date>
    </item>
    <item>
      <title>i need arrays boss @_@</title>
      <link>http://CPP.tribe.net/thread/de3648bc-4501-41a2-af05-a757fae9ea14#fe5c2b41-0f1b-41f1-88fa-5894153def4f</link>
      <description>simply put my program is suppose to be able to input 20 names and ages..then when it compiles it suppose to list the names in alphabetical order. Now I did something like this but it wasnt woth names it was with numbers. Then the program is suppose to save on a txt file.I used the same exact program that i did in class. I hardly changed the data. I compile it..it says "linker error." Also is my code correct for putting characters in alphabetical order...the internet wasnt much help with that.  Anyone help me out..here's my code...&#xD;
&#xD;
#include&amp;amp;lt;iostream.h&gt;&#xD;
#include&amp;amp;lt;string.h&gt;&#xD;
#include&amp;amp;lt;iomanip.h&gt;&#xD;
#include&amp;amp;lt;fstream.h&gt;&#xD;
void main()&#xD;
	{&#xD;
	int sku[10];&#xD;
	char description[10][25]; &#xD;
	&#xD;
	//prototypes&#xD;
	int input ( int [ ], char[ ][25]);&#xD;
	void report( int [ ], char[ ][25]);&#xD;
	void savedata( int [ ],char[ ][25]);&#xD;
	void sort( int [ ], char[ ][25]);&#xD;
&#xD;
&#xD;
	//functions&#xD;
	input( sku, description);&#xD;
	sort( sku, description);&#xD;
	report( sku, description);&#xD;
	savedata( sku, description);&#xD;
	}// close main&#xD;
&#xD;
int input( int sku[ ], char descr[ ][25])&#xD;
	{&#xD;
	int n=0; &#xD;
	char answer;&#xD;
&#xD;
	do {&#xD;
		 cout &amp;amp;lt;&amp;lt; "\nEnter the age: ";&#xD;
		 cin &gt;&gt; sku[n];&#xD;
		 cout &amp;amp;lt;&amp;lt; "\nEnter the name: ";&#xD;
		 cin &gt;&gt; descr[n];&#xD;
		 n++;&#xD;
		 cout &amp;amp;lt;&amp;lt; "\nDo want to enter another name? (y/n) ";&#xD;
		 cin &gt;&gt; answer;&#xD;
		 }while( answer == 'y' || answer == 'Y' );&#xD;
	return n;&#xD;
	}//close input&#xD;
&#xD;
void report( int sku[ ], char descr[ ][25], int n)&#xD;
	{&#xD;
	int i;&#xD;
	void drawline(char , int );&#xD;
	drawline( '_',70);&#xD;
	cout &amp;amp;lt;&amp;lt; setw(7) &amp;amp;lt;&amp;lt; "age"&#xD;
			&amp;amp;lt;&amp;lt; setw(25) &amp;amp;lt;&amp;lt; "Description"&#xD;
			&amp;amp;lt;&amp;lt; '\n';&#xD;
	drawline( '_',70);&#xD;
	for( i = 0; i &amp;amp;lt;= n-1; i++ )&#xD;
		{&#xD;
			cout &amp;amp;lt;&amp;lt; setw(7) &amp;amp;lt;&amp;lt; sku[i]&#xD;
			&amp;amp;lt;&amp;lt; setw(25) &amp;amp;lt;&amp;lt; descr[i]&#xD;
			&amp;amp;lt;&amp;lt; '\n';&#xD;
		}//close for&#xD;
	 drawline( '_',70);&#xD;
	}//close report&#xD;
//drawline() definition&#xD;
  void drawline(char c, int m )&#xD;
	{&#xD;
	int counter=1;&#xD;
		while ( counter &amp;amp;lt;= m )&#xD;
			{&#xD;
			cout &amp;amp;lt;&amp;lt; c;&#xD;
			counter++;&#xD;
			}//close while&#xD;
		cout &amp;amp;lt;&amp;lt; '\n';&#xD;
		}//close drawline&#xD;
&#xD;
void savedata( int sku[ ], char descr[ ][25], int n)&#xD;
	{&#xD;
	int i;&#xD;
	ofstream outfile;&#xD;
	outfile.open("a:names.txt", ios::app );&#xD;
&#xD;
	for( i = 0; i &amp;amp;lt;= n-1; i++ )&#xD;
		{&#xD;
			outfile &amp;amp;lt;&amp;lt; sku[i]&#xD;
			&amp;amp;lt;&amp;lt; ' ' &amp;amp;lt;&amp;lt; descr[i]&#xD;
			&amp;amp;lt;&amp;lt; '\n';&#xD;
		}//close for&#xD;
&#xD;
	outfile.close();&#xD;
&#xD;
	}//close savedata&#xD;
void sort( int sku[ ], char descr[ ][25], int n)&#xD;
	{&#xD;
	int i, j, temp;&#xD;
	char tempdes[25];&#xD;
&#xD;
	for( i = 0; i &amp;amp;lt;= n-2; i++ )&#xD;
		{&#xD;
	for( j = i+1; j &amp;amp;lt;= n-1; j++ )&#xD;
		{&#xD;
	if( descr[ j ] &amp;lt; descr[ i ] )&#xD;
		{&#xD;
		temp = sku[ i ];&#xD;
		sku[ i ] = sku[ j ];&#xD;
		sku[ j ] = temp;&#xD;
&#xD;
		strcpy( tempdes , descr[ i ]);&#xD;
		strcpy( descr[ i ] , descr[ j ]);&#xD;
		strcpy( descr[ j ] , tempdes);&#xD;
		}//close true branch&#xD;
	}//close f for loop&#xD;
}//close i for loop&#xD;
	}//close sort</description>
      <pubDate>Tue, 28 Jun 2005 21:37:23 GMT</pubDate>
      <guid isPermaLink="false">http://CPP.tribe.net/thread/de3648bc-4501-41a2-af05-a757fae9ea14#fe5c2b41-0f1b-41f1-88fa-5894153def4f</guid>
      <dc:creator>Phantom</dc:creator>
      <dc:date>2005-06-28T21:37:23Z</dc:date>
    </item>
  </channel>
</rss>



