Ben Chambers
2012-04-25 02:48:10 UTC
Write a program that:
- Initializes a char array with the letters 'a', 'b', 'c'
- Prints out the array on screen
I'm trying to have the user input the chars with this code:
#include
int main()
{
using namespace std;
int counter = 0;
string set[3];
while(counter <=2)
{
printf ("enter char for location %d:", counter);
scanf ("%c", &set[counter]);
counter++;
}
}
However it doesn't seem to work properly. Can anyone tell me what is wrong here and how to have the chars printed out on-screen individually?
Many Thanks!
Ben