why isnt this program working?

#include <iostream>
#define SIZE  10;
using namespace std;


main ()
{
char Black,Brown,Red,Orange,Yellow,Green,Blue,Purple,Grey,White;
int a;
int Color[10];
{ int i, array[size];

for (i = 0; i < size; i++)
   {
   array[i] = i;
   }
}
cout<<"enter the color of the stripe"<<endl;
cin>>Color[i];

color[0]=Black;
color[1]=Brown;
color[2]=Red;
color[3]=Orange;
color[4]=Yellow;
color[5]=Green;
color[6]=Blue;
color[7]=Purple;
color[8]=Grey;
color[9]=White;
getchar();
cout<<"the number of the color you entered is"<<i;
}

Recommended Answers

All 3 Replies

Member Avatar for iamthwee

>why isnt this program working?

Well what compiler errors do you get?

ok here they are


C:\Documents and Settings\All Users\Documents\trying to figure out.cpp In function `int main()':

11 C:\Documents and Settings\All Users\Documents\trying to figure out.cpp `size' undeclared (first use this function)

(Each undeclared identifier is reported only once for each function it appears in.)

15 C:\Documents and Settings\All Users\Documents\trying to figure out.cpp `array' undeclared (first use this function)

19 C:\Documents and Settings\All Users\Documents\trying to figure out.cpp `i' undeclared (first use this function)

21 C:\Documents and Settings\All Users\Documents\trying to figure out.cpp `color' undeclared (first use this function)

> #define SIZE 10;
Step 1 is remove the ;

Step 2 is to stop using the pre-processor to declare constants in C++ programs, and declare const int SIZE = 10;

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.