Do while Loop

I am needing help creating a do while loop where the first thing is to create a customer number that increases with each loop.

const int NAME_SIZE = 20;
const int STREET_SIZE = 30;
const int CITY_SIZE = 20;
const int STATE_CODE_SIZE = 3;

struct Customers {
long customerNumber;
char name[NAME_SIZE];
char streetAddress_1[STREET_SIZE];
char streetAddress_2[STREET_SIZE];
char city[CITY_SIZE];
char state[STATE_CODE_SIZE];
int zipCode;
char isDeleted;
char newLine;
};

any help or direction is appreciated
First you should define a class for Customers, so you can use methods to registrate a new customer.

You can use strings for your char arrays, length of strings can be restricted at Input.

Maybe like this:

class Customers
{
private:
static long zaehler;
long customerNumber;
string name;
string streetAddress_1;
string streetAddress_2;
string city;
string state;
int zipCode;
// why you need this char's?
char isDeleted;
char newLine;

public:
Customers(){
this.customerNumber = zaehler;
zaehler++;
}
Customers(string name, string streetAddress_1, string streetAddress_2, string city, string state, int zipCode)
{
this.customerNumber = zaehler;
zaehler++;
this.name = name;
this.streetAddress_1 = streetAddress_1;
this.streetAddress_2 = streetAddress_2;
this.city = city;
this.state = state;
this.zipCode = zipCode;
}

~Customers(){}
};

Didn't tested it, but it should work like this or do you want to program in C?
If you only want to do a do while Loop, it can look like this:

do
{
//Output: "Give me your Data"
//Input
//give the user a number
//Number++
}while(/*Input isn't "Escape-Sequence"*/)
Topic archived. No new replies allowed.