Boolean and flags

In my program for one procedure I am reading in the colors for resistance bands then setting them to true if they're being used. In another procedure I need to output only the flagged bands, and was unsure how to approach this. I'm also not supposed to use classes, just array of records. Here's my code so far

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;

enum bandtype {YELLOW, GREEN, RED, BLUE, BLACK};


struct bandrecord
{
string bandcolor;
int weight;
bool is_used;
};
bandrecord bandSetup[4];


void setup (ifstream &, bandrecord[]);
//reads in string and band resistance
//sets flag to false
void getbands (istream &, bandrecord[]);
//requests bands from user and sets flag to true
bandtype str_to_color (const string &);
//converts string to color
//used in getbands procedure
void printbands (ostream &, const bandrecord[]);
//prints name of each band and resistance
//for each band selected
int totalresistance (const bandrecord[]);
//returns total resistance for all bands selected
void resetbands (bandrecord[]);
//sets the is_used flag to false
void weight_to_bands(int, bandrecord[]);
//for part 2 of program
//calcualtes the bands used and sets the is_used flag
int main()
{

system ("pause");
return 0;
}

void setup (ifstream & Setupbands, bandrecord[])
{
is_used = true;
while (is_used)
{
Setupbands >> bandSetup[0].bandcolor >> bandSetup[0].weight
>> bandSetup[1].bandcolor >> bandSetup[1].weight
>> bandSetup[2].bandcolor >> bandSetup[2].weight
>> bandSetup[3].bandcolor >> bandSetup[3].weight;

is_used = false;
}
}

void getbands (istream & inputbands, bandrecord[])
{
inputbands >> bandcolor
while (!(string == "stop")
{
is_used = true;
bandtype str_to_color ()
inputbands >> bandcolor
}

}

bandtype str_to_color (const string &)
{
switch (bandcolor)
{
case "yellow" : bandtype = YELLOW;
break;
case "green" : bandtype = GREEN;
break;
case "red" : bandtype = RED;
break;
case "blue" : bandtype = BLUE;
break;
case "black" : bandtype = BLACK;
break;
}
}

void printbands (ostream & outputbands, const bandrecord[])
{

}

int totalresistance (const bandrecord[])
{

}

void resetbands (bandrecord[])
{

}

void weight_to_bands(int, bandrecord[])
{

}



Topic archived. No new replies allowed.