This is the program. Re-using the tuition calculations from Lab1, and write a program to do the following:
Read student classifications and numbers of units from the data file LAB2IN.TXT. (No error
checking of data read from input file is required.) Then write each student's resulting tuition to a
second data output file, LAB2OUT.TXT.
As each tuition is computed, save it in one of two arrays for further processing at the end of the
program. The first array will hold the tuition paid by undergraduate students, and the second will
hold the tuition paid by graduate students. There will be no more than 100 students of either
type, and there may be only one type in the file.
After ALL of the tuitions have been computed, use the data in the arrays to calculate the low, high,
and average tuition paid by undergraduate students and the low, high, and average taxes paid by
graduate students (Do NOT compute the sums or any other part of the low, high, and averages until
AFTER all tuitions have been computed and placed in the arrays). Display the results to the
screen, along with a count of the type of student, as follows (same format for graduate students):
Lowest tuition paid = \$ 750.00
Highest tuition paid = \$ 5100.00
Average tuition paid = \$ 4566.12
Break the program into functions. Include at least the following functions:
Compute one tuition Compute the low/high/average tuition paid
Write one result to the file Display the low/high/average tuition paid
Input: File LAB2IN.TXT format is one line per tuition paying student, as follows:
Classification: character (uppercase U or G)
Units: positive integer
Sample Lines: U 20
G 9
NOTE: You will have to create your own sample data file to test this program, but
you instructor will use one of his/her own creation

The first issues is with the funcation. Not to sure how i would set them up. I'm use to pascal where i can write a funcation and it does that and its call from the main program. But Im a little lost on this one. becasue what I have written dose not look right.

``````/*****************************************
File Name: Tmitchellwk2
Description: Calcutaing tuition based on Classification and number of
credits
Date: 7/18/06
Desinger: Tabatha Mithcell
Functions: Input, output
*****************************************/#include <stdio.h>

main ()

{
#define flatfeeone 500.00 /*flat rate for up to 6 credits*/
#define Flatfeeu 450.00 /*rate for undergrad rate for 6 to 12
credits*/
#define Flatfeeg 750.00 /*rate for graduate for 6 to 12 credits*/
#define flatunit 250.00 /*rate for fee per credit up to 6 credits*/
#define Flatunitu 245.00 /*rate for undergrate for 6-12 credits*/
#define Flatunitg 285.00 /*rate for graduate for 6-12 credits*/
#define Flatpuu 270.00 /*rate for undgrade for 12-18 credits*/
#define Flatgu 340.00 /*rate for graduate for 12-18 credit*/
#define Flatu 5100.00 /*rate for undgrade for 18 or more credits*/
#define Flatg 6400.00 /*rate for graduate for 18 or more credits*/

int credits; /*number of credits the person is taking*/``````
``````int datain; /*funstion to get data from file.
FILE *indate, *outdata; //Input file

Function Datain;

indata = fopen ("C.\\LAB2IN.txt", "r");

if (fopen == Null)
printf ("Error openeing file\n);

else
while (fscan (fin, "%c", &status) != EOF){//READ ONE STATUS
print ("t%c\n", status);

if ( (status == 'g') || (status == 'G') ) //stating the calculations for grad
{

if ( (credits > 0) && (credits <= 6) )
cost = flatfeeone + (credits * flatunit);

if ((credits > 6) && (credits <= 12))
cost = Flatfeeg + (credits *Flatunitg);

if ((credits > 12) && (credits <=18))
cost = Flatgu * credits;

if (credits > 18)
cost = Flatg;

}
else if ((status == 'u') || (status == 'U')) //starting the calculations for undergrad
{

if ( (credits > 0) && (credits <= 6))
cost = flatfeeone + (credits * flatunit);

if ( (credits > 6) && (credits <= 12))
cost = Flatfeeu + (credits *Flatunitu);

if ( (credits > 12 ) && (credits <= 18))
cost = Flatpuu * credits;

if (credits > 18)
cost = Flatu;

}

datain;

getchar();
getchar();
return 0;
}``````

All 16 Replies

``````//I need to use these header files to do what I want

//the following values are defined as constants

//At minimum I need to use these functions:
Compute one tuition
Compute the low/high/average tuition paid
Write one result to the file
Display the low/high/average tuition paid

//The process would be:

//declare variables to use
a given student
something to read to/from a file

open file
test if file opened successfully
while there is information to be read in th input file
read in a single students information
compute this students tuition
store tuition in appropriate array
write tuition to file
Compute the low/high/average tuition paid
Display the low/high/average tuition paid``````

Now go back and try to expand on each of those lines as needed until you get to code to compile---only write one function at a time! I don't use C so the code in here is best guess only. Even if in error, the code should give you an idea of how to do proceed.

``````//I need to use these header files to do what I want
#include <cstdio>    //standard input and output for C language

//the following values are defined as constants
//a list of defines from your snippet could go here

//At minimum I need to use these functions: // these will be function prototypes
int readStudentDataFromFile(FILE *, char &, int &);
//Compute one stgudents tuition
//Compute the low/high/average tuition paid
//Write one result to the file
//Display the low/high/average tuition paid

//The process would be:
int main()
{

//declare variables to use:
const int MAX = 100;  //maximum number of tuitions per array

//a given student
char status;  //will be either U or G
int credits;   //will be greater than zero

//something to read to/from a file
FILE * filePtr;
char * inputFIleName = "testData.txt";

//open file
fopen(filePtr, inputFileName, "r");  //or whatever, I usually use C++ so this is just a guess

//test if file opened successfully
//should have learned how to do this in class

//read in a single students information

//while there is information to be read in the input file
{
//confirm data read in from file
printf("status of this student is %c \n", status);
printf("number of credits for this student are %d, credits);

getch();

//compute this students tuition
//store tuition in appropriate array
//write tuition to file

//read in a single students information
}
//Compute the low/high/average tuition paid for undergraduates
//Display the low/high/average tuition paid
//Compute the low/high/average tuition paid for graduates
//Display the low/high/average tuition paid

return 0;
}

//function definitions here:
int readStudentDataFromFile(FILE * filePtr, char & status, int & credits)
{
int numb= fscanf(filePtr, "%c %d", &status, &credits);
return numb;
}

//create a text file called testData.txt containing something like this to start
U 9
G 17``````

Once you can create a testData file, open it, and read in a students values, one student at a time, then go on to the next function. BEWARE of bugs in this "program" so far. I haven't compiled/ran it. This is just to give you an idea of how to proceed.

Thanks I will try to work it that way. can you explain how the funcations work. I'm still thinking that they are like pascal. Where when i write the fruncation then the job goes and pulls that funcations runs it then moves on the the next funcation.

The function prototype tells the compiler that there will be a function of a given name using a given number and type of parameters that will be presented in a given order and that the function will return a given type. The definition, which can be placed before main() is declared, if you wish, instead of the prototype, will include all of that information and will include names of all of the parameters as well as the function body.

The function will do whatever it is told to do in the body of definition to the parameters it is passed and return whatever it is told to.

In my example:

int readStudentDataFromFile(FILE *, char &, int &);

is the prototype. With this information the compiler knows that the function readStudentDataFromFile() will take three parameters. The first parameter will be a pointer to a struct of type FILE, the second parameter will be a reference to a char, and the third will be a reference to an int. In addition the function will return an int. At this point, there is no way to know exactly what the function will do. That information is what is in the function body.

The following is the definition of the readStudentDataFromFile() function.

int readStudentDataFromFile(FILE * filePtr, char & status, int & credits)
{
int numb= fscanf(filePtr, "%c %d", &status, &credits);
return numb;
}

Now each of the parameters is given a name. Within the opening { and the closing } are instructions as to what the function will do with the parameters. In this case all three of the parameters passed to readStudentDataFromFile() are passed to the fscanf() function. In turn, fscanf() will read the contents of the file that was previously opened and asssociated with filePtr. fscanf() will put the first token it finds in the file into the address of the parameter called status and it will put the second token in the file into the address of the parameter called credits. fscanf() will return the number of variables it read in which is then stored in numb. numb is then returned from readStudentDataFromFile() back to where ever it was called from. The return value can be used for whatever purpose you want, including ignoring it, but I used it as a check to help ensure proper reading of the file.

In main() I told the program to call readStudentDataFromFile() when I wrote this:

This says to pass the variables filePtr, status, and credits to readStudentDataFromFile() and that the return value of readStudentDataFromFile(), that is numb, will be assigned to numberRead.

The while loop in main says if numberRead doesn't equal 2 then fscanf didn't read stuff from the file correctly so readStudentDataFromFile() should stop being called. Hopefully, that doesn't happen until the end of the file. If numberRead wasn't 2 you could check it's value. If numberRead equals EOF, then you are at the end of the file and alls well. If numberRead is anything but 2 or EOF, then the file is probably corrupt. I didn't do those steps, however. In my code, I just left it that if numberRead is 2 I will confirm what data was read in with the printf() statements and pause the program long enough so I can read them and check them against the data in my test file.

If everything checks out to this point then I know I can: open and associate the correct file with my program and I can read data from the file in the way I want. Now I can go on to deal with that information according to the instructions given by the instructor.

Note that all three parameters passed to readStudentDataFromFile() were passed by reference. This means that whatever is done to them in readStudentDataFromFile() will be visible back in main(). So in this example where the file read had the first student data of U 9, the value of status back in main() will be U and the value of credits back in main() will be 9, even though the value of those variables was determined in readStudentDataFromFile() which in turn really got the data from fscanf(), again, by passing the parameters to fscanf() by reference, rather than by value. I don't think any of the other functions you will need to write for this program will embed a function within a function like readStudentDataFromFile() did, but it is a very common practice.

This is where I have gotten so far. But I'm having issues reading more then one line of data. And and lost on how to put these items into tow arrays any help. please. I could get it to read from the file and out it on the display but not save to the file.

``````/*****************************************
File Name: Tmitchellwk2
Description: Calcutaing tuition based on Classification and number of
credits
Date: 7/18/06
Desinger: Tabatha Mithcell
Functions:  Input, output
*****************************************/#include <stdio.h>
main ()
{
#define flatfeeone 500.00    /*flat rate for up to 6 credits*/
#define Flatfeeu  450.00    /*rate for undergrad rate for 6 to 12
credits*/
#define Flatfeeg  750.00    /*rate for graduate for 6 to 12 credits*/
#define flatunit  250.00    /*rate for fee per credit up to 6 credits*/
#define Flatunitu  245.00    /*rate for undergrate for 6-12 credits*/
#define Flatunitg  285.00    /*rate for graduate for 6-12 credits*/
#define Flatpuu    270.00    /*rate for undgrade for 12-18 credits*/
#define Flatgu     340.00    /*rate for graduate for 12-18 credit*/
#define Flatu     5100.00    /*rate for undgrade for 18 or more credits*/
#define Flatg     6400.00    /*rate for graduate for 18 or more credits*/

int credits;    /*number of credits the person is taking*/
float cost;    /*amount of tutition*/
FILE *indata, *outdata;      //Input file and output files
indata = fopen ("e:\\LAB2IN.txt", "r");
outdata = fopen ("e:\\LAB2OUT.txt", "w");

if (indata == NULL && outdata == NULL){
printf ("Error opening one of the files \n\n");}
while (fscanf (indata, "%c" ,&status,  "%d", &credits) == EOF)
if(status == 'G')  //stating the calculations for grad
{

if ( (credits > 0) && (credits <= 6) )
cost =  flatfeeone + (credits * flatunit);

if ((credits > 6) && (credits <= 12))
cost =  Flatfeeg + (credits *Flatunitg);

if  ((credits > 12) && (credits <=18))
cost = Flatgu * credits;

if (credits > 18)
cost = Flatg;

}
else if (status == 'U')  //starting the calculations for undergrad
{

if ( (credits > 0) && (credits <= 6))
cost = flatfeeone + (credits * flatunit);
if ( (credits > 6) && (credits <= 12))
cost =  Flatfeeu + (credits *Flatunitu);
if  ( (credits > 12 ) && (credits <= 18))
cost = Flatpuu * credits;
if (credits > 18)
cost = Flatu;
}

fprintf (outdata, "\nClass    %c", status);
fprintf (outdata, "\nUnits     %d", credits);
fprintf (outdata, "\nTuition  \$%.2f\n", cost);
fclose (indata); //close the indata file
fclose (outdata); //close the indata file
printf ("Output file is compelete.");
}
getchar();
getchar();
return 0;
}``````

I'm having issues reading more then one line of data.

Here is a template for doing so.

``````#include <stdio.h>

int main()
{
static const char filename[] = "file.txt";
FILE *file = fopen(filename, "r");
if ( file != NULL )
{
char line[32];
while ( fgets(line, sizeof line, file) != NULL )
{
char type;
int  value;
if ( sscanf(line, "%c %d", &type, &value) == 2 )
{
printf("type = '%c', value = %d\n", type, value); /* test/debug */
/* do stuff */
}
}
}
else
{
perror(filename);
}
return 0;
}

/* file.txt
U 20
G 9
*/

/* my output
type = 'U', value = 20
type = 'G', value = 9
*/``````

And and lost on how to put these items into tow arrays any help. please. I could get it to read from the file and out it on the display but not save to the file.

Take a stab at putting it into an array. Declare an array, attempt to use the array correctly. Give it a shot.

I can get it to read from the file. I need to get some help having it sort into the arrays. Can someone help me. I'm lost on how to get it to do that.

:?:

``````/*****************************************
File Name: Tmitchellwk2
Description: Calcutaing tuition based on Classification and number of
credits
Date: 7/18/06
Desinger: Tabatha Mithcell
Functions:  Input, output
*****************************************/#include <stdio.h>
main ()
{
#define flatfeeone 500.00    /*flat rate for up to 6 credits*/
#define Flatfeeu  450.00    /*rate for undergrad rate for 6 to 12
credits*/
#define Flatfeeg  750.00    /*rate for graduate for 6 to 12 credits*/
#define flatunit  250.00    /*rate for fee per credit up to 6 credits*/
#define Flatunitu  245.00    /*rate for undergrate for 6-12 credits*/
#define Flatunitg  285.00    /*rate for graduate for 6-12 credits*/
#define Flatpuu    270.00    /*rate for undgrade for 12-18 credits*/
#define Flatgu     340.00    /*rate for graduate for 12-18 credit*/
#define Flatu     5100.00    /*rate for undgrade for 18 or more credits*/
#define Flatg     6400.00    /*rate for graduate for 18 or more credits*/
#define max 50 //max number of records

int credits;    /*number of credits the person is taking*/
float cost;    /*amount of tutition*/
int under [max][2];//funstion for array of undergrads
FILE *indata, *outdata;      //Input file and output files

indata = fopen ("e:\\LAB2IN.txt", "r");
outdata = fopen ("e:\\LAB2OUT.txt", "w");

if (indata == NULL)
printf ("Error openeing file\n");

else{
}
while (fscanf (indata, "%c" ,&status,  "%d", &credits) != EOF)
printf ("%c", status, "%d\n", credits);
if(status == 'G')  //stating the calculations for grad
{

if ( (credits > 0) && (credits <= 6) )
cost =  flatfeeone + (credits * flatunit);

if ((credits > 6) && (credits <= 12))
cost =  Flatfeeg + (credits *Flatunitg);

if  ((credits > 12) && (credits <=18))
cost = Flatgu * credits;

if (credits > 18)
cost = Flatg;
fprintf (outdata, "%c %d %.2f\n", under[max][0]);
printf ("%c %d %.2f\n", under[max][0]);
}
else if (status == 'U')  //starting the calculations for undergrad
{

if ( (credits > 0) && (credits <= 6))
cost = flatfeeone + (credits * flatunit);
if ( (credits > 6) && (credits <= 12))
cost =  Flatfeeu + (credits *Flatunitu);
if  ( (credits > 12 ) && (credits <= 18))
cost = Flatpuu * credits;
if (credits > 18)
cost = Flatu;
fprintf (outdata,  "%c %d %.2f\n" , grad[max][0]);
printf ("%c %d %.2f\n" , grad[max][0]);
}
}
fclose (indata); //close the indata file
fclose (outdata); //close the indata file
printf ("Output file is compelete.");
getchar();
getchar();
return 0;
}``````

int under [max][2];//funstion for array of undergrads

These are two dimensional arrays. Why in the world do you need that? Just us a single dimensional array of size max for each.

In reality to you could compare each new tuition to current max and min tuition as it is calculated. You could even calculate the average tuition on the fly, if you wanted. However, the instructions require you to keep track of the tuitions in an array, and then describe the contents of the array. You can loop through the array to find the high and low, and if you keep track of how many tuitions are stored in the array it shouldn't be hard to calculate the average.

``````int under[max];
.
.
.
if (credits > 18)
cost = flatg;

//write amount of tuition to file
fprintf (outdata, "%d", cost);

under[i] = cost;  //store tuition in array for undergraduate tuition at whatever index is appropriate.``````
``while (fscanf (indata, "%c" ,&status,  "%d", &credits) != EOF)``

If you're going to ignore my advice, why should I spend time giving more?

I need to have it sorted into tow arrays first and save to a file. That is where i'm having my issues.

int under [max][2];//funstion for array of undergrads

These are two dimensional arrays. Why in the world do you need that? Just us a single dimensional array of size max for each.

In reality to you could compare each new tuition to current max and min tuition as it is calculated. You could even calculate the average tuition on the fly, if you wanted. However, the instructions require you to keep track of the tuitions in an array, and then describe the contents of the array. You can loop through the array to find the high and low, and if you keep track of how many tuitions are stored in the array it shouldn't be hard to calculate the average.

``````int under[max];
.
.
.
if (credits > 18)
cost = flatg;

//write amount of tuition to file
fprintf (outdata, "%d", cost);

under[i] = cost;  //store tuition in array for undergraduate tuition at whatever index is appropriate.``````

As each tuition is computed, save it in one of two arrays for further processing at the end of the
program. The first array will hold the tuition paid by undergraduate students, and the second will
hold the tuition paid by graduate students. There will be no more than 100 students of either
type, and there may be only one type in the file.

I interpret that to mean you declare two arrays, one for tuition values for undergraduates and one for tuition values for graduate students, not that you need a two dimensional array. So I would do it as:

int under [100];

not

int under[100][2];

In theory you could use a single two dimensional array to keep track of the tuitions, but that isn't what you are supposed to do, as far as I can tell.

I also think you should use the folowing flow:

in a loop:
read a given students information from file
calculate the given students tuition
write the given students tuition to file
store the given students tuition into one of the two arrays

after the loop is completed:
calculate the min/max/average for each array.

That is where I'm having my issues. I sont understand how to write it. I though a two dimensional array would help but to sort out the grads from undergrads. But i might just be making this harder then it needs to be. Could i sort the data by a case and then once its in the case and saved to the new file then do the array. or am i just on the wrong tract. i hate doing online classes at times. :)

Ok i give up. I went a head and turned in what i has which of cousre was way off. Can someone help me with my code. can some one walk show me where i went wrong. THe assingment is listed in the first post. Help please.

``/*****************************************File Name: Tmitchellwk2Description: Copy data from one file and put it into another fiel while sorting it into two array based on what the status is.  The do some calculations base on the arryas  creditsDate: 7/18/06Desinger: Tabatha MithcellFunctions:  Input, output*****************************************/#include <stdio.h>#include  <stdio.h>/*************************************************FUNCTION:        mainDESCRIPTION:    gather user input from a file and read. INPUT:  Parameters:    read input from file  Keyboard:        n/a than '0'  File:            lab2in, lab2outOUTPUT:  Return Value:    n/a  Parameters:    sort the items into two arrys based on the status of the student.  Display: will show you the lowest, hightes tutions, and show an avarge of the tutions that.*****************************************************************/   #define flatfeeone 500.00    /*flat rate for up to 6 credits*/  #define Flatfeeu  450.00    /*rate for undergrad rate for 6 to 12credits*/  #define Flatfeeg  750.00    /*rate for graduate for 6 to 12 credits*/  #define flatunit  250.00    /*rate for fee per credit up to 6 credits*/  #define Flatunitu  245.00    /*rate for undergrate for 6-12 credits*/  #define Flatunitg  285.00    /*rate for graduate for 6-12 credits*/  #define Flatpuu    270.00    /*rate for undgrade for 12-18 credits*/  #define Flatgu     340.00    /*rate for graduate for 12-18 credit*/  #define Flatu     5100.00    /*rate for undgrade for 18 or more credits*/  #define Flatg     6400.00    /*rate for graduate for 18 or more credits*/  #define max   50 //max number of qrray linesint main (); int credits;    /*number of credits the person is taking*/char status;    /*Student status (G,g-Grad or U,u-Undergrad)*/float cost;    /*amount of tutition*/int grad [max][3];//x,y any numberint under [max][3];int BinarySearch (int grad , int cost); //function for array of gradsint BinarySearch1 (int under, int cost);//funstion for array of undergradsFILE *indata, *outdata;      //Input file and output filesindata = fopen ("e:\\LAB2IN.txt", "r");outdata = fopen ("e:\\LAB2OUT.txt", "w"); if (indata == NULL && outdata == NULL){  printf ("Error opening one of the files \n\n");}  do{fscanf (indata, "%c", &status,  "%d", &credits); //reads the data from the fileif(status == 'G')  //stating the calculations for grad{              if ( (credits > 0) && (credits <= 6) )        cost =  flatfeeone + (credits * flatunit);             if ((credits > 6) && (credits <= 12))         cost =  Flatfeeg + (credits *Flatunitg);                      if  ((credits > 12) && (credits <=18))         cost = Flatgu * credits;         if (credits > 18)       cost = Flatg;      }    else if (status == 'U')  //starting the calculations for undergrad{              if ( (credits > 0) && (credits <= 6))        cost = flatfeeone + (credits * flatunit);       if ( (credits > 6) && (credits <= 12))        cost =  Flatfeeu + (credits *Flatunitu);      if  ( (credits > 12 ) && (credits <= 18))        cost = Flatpuu * credits;     if (credits > 18)        cost = Flatu;} //array for the gradelse if (status == 'G'){fprintf grad[0][0] = status;fprintf grad[0][0] = credits;fprintf grad[0][1] = cost;}  //array for undergradif (status == 'U'){fprintf grad[0] [0] = status;fprintf under[0][0] = credits;fprintf under[0][1] = cost;}while (status != '\0' || credits != 0)} //find the tution for the lowest higher and get avarge of tutions/**********************fuction that starts the binsry search for grands**********************/  int BinarySearch (int grad [], int max, int Cost);/* List = array containing data *//* Size = number of items in the array *//* searchKey = item we are searching for *//* return value = index where item is found (-1 if not found) */{  int Found = FALSE; /* initially key not found */  int Place = -1; /* Place holds index where key is found */  int Low = 0; /* Lowest index to search */  int High = Size - 1; /* Highest index to search */  int Middle; /* Middle of current search range */    while ( !Found && (Low <= High)) {     Middle = (Low + High) / 2;      if (cost < List[Middle])      High = Middle - 1;     else if (cost > List[Middle])       Low = Middle + 1;     else {       Found = TRUE;       Place = Middle;} /* else */} /* while */return Place;fprint ("For", max, "graduate students:");fprint ("Lowest tuition piad =   \$%.2f\n", LOw);fprint ("Highest tuition piad =   \$%.2f\n", HIgh);fprint ("Avarage tuition piad =   \$%.2f\n", Average);} /* end BinarySearch */}/**************Fuction to put undergrade into arrays and find the lowestand highest tuion anf avarage*************************************/{ //find the tution for the lowest higher and get avarge of tutionsint BinarySearch1 (int under [], int max, int Cost);/* List = array containing data *//* Size = number of items in the array *//* searchKey = item we are searching for *//* return value = index where item is found (-1 if not found) */int Found = FALSE; /* initially key not found */int Place = -1; /* Place holds index where key is found */int Low = 0; /* Lowest index to search */int High = Size - 1; /* Highest index to search */int Middle; /* Middle of current search range */while ( !Found && (Low <= High)) {Middle = (Low + High) / 2;if (cost < List[Middle])High = Middle - 1;else if (cost > List[Middle])Low = Middle + 1;else {Found = TRUE;Place = Middle;} /* else */} /* while */return Place;fprint ("For", max, "undergraduate students:");fprint ("Lowest tuition piad =   \$%.2f\n", LOw);fprint ("Highest tuition piad =   \$%.2f\n", HIgh);fprint ("Avarage tuition piad =   \$%.2f\n", Average);} /* end BinarySearch1 */   fclose (indata); //close the indata filefclose (outdata); //close the indata fileprintf ("Output file is compelete.");}getchar();getchar();return 0;}``

every time i put that into the rile the compiler did not like it.

If you're going to ignore my advice, why should I spend time giving more?

Could i sort the data by a case and then once its in the case and saved to the new file then do the array

yes, just store it in the appropriate array based on the case, U vs G.

that was what i war trying to do. I wanted it to find teh tution then story it. But i can't get the right code to do that. I wanted to know if someone could help me fix the code that i did post. So that I would know where I went wrong. I think that I needed more function in order to do the program. But my brain is not working with me at this time. I seem to have some to a dead end. The hearest thing for me to do is to do arrays.

every time i put that into the rile the compiler did not like it.

Well that's a useless reply. Perhaps what you meant to say was something like this:

This is the exact code I used:

``/*...*/``

It produces the following errors:

``errors``

What is wrong?