Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

words and sentences in arrays

Status
Not open for further replies.

AdamWalker

IS-IT--Management
Oct 27, 2004
2
US
can someone please tell me how to get full words and sentences into the category section of the following array. i tried declaring the char as category[20] but it doesn't seem to work. i am just beginning c++, please could someone help. thanks.


#include <iostream.h>

int main()
{

struct SiteType
{
int refNumber;
char category;
float siteVal;
}; // Note semi colon needed here

SiteType readings[5];

int index;
for (index = 0; index < 5; index++)
{

readings[index].refNumber = 1;
readings[index].category = 'A';
readings[index].siteVal = 3;
}


cout << &quot;Reference Category Value&quot; << &quot;\n&quot;;
for (index = 0; index < 5; index++)
{
cout << readings[index].refNumber << &quot; &quot;
<< readings[index].category << &quot; &quot;
<< readings[index].siteVal << &quot;\n&quot;;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top