# Newbie needs Help!!

Somebody can fix it?
//program to help for controlling sales and compute statistical information
//about sales in stores each day.
#include
#include
class sales
{
private:

int day,month,year,group,total_sale,amount[];
void check_max();
void check_min();
public:
void introduction();
void compute();
};
void check_max()
{ int size=5,max;
max=amount[0];
for (i=0;i>amount[i];
if(amount[i]>max)
max=amount[i];}
cout<<"The maximun amount is:"<<max<<endl;
}
void check_min()
{ int size=5;
min=amount[0];
for (i=0;i<size;i++)
{cin>>amount[i];
if(amount[i]>day>>month>>year;
do{
cout<<"enter the group and amount(only group 1,2,3,4,5):";
cin>>group>>amount[size];
}while(group!=1||group!=2||group!=3||group!=4||group!=5);
ifstream fin;
char ans;
while{
cout<<"Take the data from the file?(yes or no)"
if (ans=='y'|| ans=='Y')
fin.open("data.txt");
}
}
void compute()
{
for(i=0;i<size;i++)
{
if(group=1){total_sale=amount[i];
cout<<"The total sales for group 1 is :"<<total_sale<<endl;
check_max();
check_min();
}
if(group=2){total_sale=amount[i];
cout<<"The total sales for group 2 is :"<<total_sale<<endl;
check_max();
check_min();
}
if(group=3){total_sale=amount[i];
cout<<"The total sales for group 3 is :"<<total_sale<<endl;
check_max();
check_min();
}
if(group=4){total_sale=amount[i];
cout<<"The total sales for group 4 is :"<<total_sale<<endl;
check_max();
check_min();
}
if(group=5){total_sale=amount[i];
cout<<"The total sales for group 5 is :"<<total_sale<<endl;
check_max();
check_min();
}
}
int main()
{
sales sale;
sales.compute();
return 0;
}

• 1) well you cant make an array like this: array1[]
it has to have a predefined numbers of elements, this is for 3 elements:
array1[3]

2 In several situations you didn't declare variables before using them or you declared a variable inside a function( to use it in other functions you need to declare it right after your #include statements

example to declare an integer named num : int num;

3) as far as running how you want it to this probably isn't right(i didn't know exactly what the purpose was ), but it runs without syntax errors so maybe you can correct this to run as you want it to here's the code i came up with:

//program to help for controlling sales and compute statistical information
//about sales in stores each day.
#include"stdafx.h"
#include
#include
class sales
{
public:

int day,month,year,group,total_sale,amount[5];
void check_max();
void check_min();

void introduction();
void compute();
};
void sales::check_max()
{ int size=5,max;
max=amount[1];
for (int i=0;i>amount[i];
if(amount[i]>max)
max=amount[i];}
cout<<"The maximun amount is:"<<max<<endl;
}

void sales::check_min()
{ int size=5;
int min=amount[0];
for (int i=0;i<size;i++)
{cin>>amount[i];
if(amount[i]>day>>month>>year;
do{
cout<<"enter the group and amount(only group 1,2,3,4,5):";
cin>>group>>amount[0];}
while(group!=1||group!=2||group!=3||group!=4||group!=5);
ifstream fin;
char ans;
while (ans!='y' && ans != 'Y'){
cout<<"Take the data from the file?(yes or no)";
if (ans=='y'|| ans=='Y')
{
fin.open("data.txt");
}
}
}
void sales::compute()
{
int size;
for(int i=0; i < size ;i++)
{
if(group=1){total_sale=amount[i];}

cout<<"The total sales for group 1 is :"<<total_sale<<endl;
check_max();
check_min();

if(group=2){total_sale=amount[i];}

cout<<"The total sales for group 2 is :"<<total_sale<<endl;
check_max();
check_min();

if(group=3){total_sale=amount[i];}

cout<<"The total sales for group 3 is :"<<total_sale<<endl;
check_max();
check_min();

if(group=4){total_sale=amount[i];}

cout<<"The total sales for group 4 is :"<<total_sale<<endl;
check_max();
check_min();

if(group=5){total_sale=amount[i];}

cout<<"The total sales for group 5 is :"<<total_sale<<endl;
check_max();
check_min();
}
}
int main()
{
sales sale;
sale.compute();
return 0;
}

: Somebody can fix it?
: //program to help for controlling sales and compute statistical information
: //about sales in stores each day.
: #include<iostream>
: #include
: class sales
: {
: private:
:
: int day,month,year,group,total_sale,amount[];
: void check_max();
: void check_min();
: public:
: void introduction();
: void compute();
: };
: void check_max()
: { int size=5,max;
: max=amount[0];
: for (i=0;i>amount[i];
: if(amount[i]>max)
: max=amount[i];}
: cout<<"The maximun amount is:"<<max<<endl;
: }
: void check_min()
: { int size=5;
: min=amount[0];
: for (i=0;i<size;i++)
: {cin>>amount[i];
: if(amount[i]>day>>month>>year;
: do{
: cout<<"enter the group and amount(only group 1,2,3,4,5):";
: cin>>group>>amount[size];
: }while(group!=1||group!=2||group!=3||group!=4||group!=5);
: ifstream fin;
: char ans;
: while{
: cout<<"Take the data from the file?(yes or no)"
: if (ans=='y'|| ans=='Y')
: fin.open("data.txt");
: }
: }
: void compute()
: {
: for(i=0;i<size;i++)
: {
: if(group=1){total_sale=amount[i];
: cout<<"The total sales for group 1 is :"<<total_sale<<endl;
: check_max();
: check_min();
: }
: if(group=2){total_sale=amount[i];
: cout<<"The total sales for group 2 is :"<<total_sale<<endl;
: check_max();
: check_min();
: }
: if(group=3){total_sale=amount[i];
: cout<<"The total sales for group 3 is :"<<total_sale<<endl;
: check_max();
: check_min();
: }
: if(group=4){total_sale=amount[i];
: cout<<"The total sales for group 4 is :"<<total_sale<<endl;
: check_max();
: check_min();
: }
: if(group=5){total_sale=amount[i];
: cout<<"The total sales for group 5 is :"<<total_sale<<endl;
: check_max();
: check_min();
: }
: }
: int main()
: {
: sales sale;