Click here to Skip to main content
15,916,019 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: TextBox Pin
valikac2-May-04 14:50
valikac2-May-04 14:50 
GeneralRe: Thanks Kuphryn Its works .... Pin
bishead2-May-04 15:36
bishead2-May-04 15:36 
GeneralGlobal variables with ATL COM objects Pin
2-May-04 8:00
suss2-May-04 8:00 
GeneralRe: Global variables with ATL COM objects Pin
Michael Dunn2-May-04 8:10
sitebuilderMichael Dunn2-May-04 8:10 
GeneralCopy Constructor Pin
Madmaximus2-May-04 7:45
Madmaximus2-May-04 7:45 
GeneralRe: Copy Constructor Pin
Michael Dunn2-May-04 8:17
sitebuilderMichael Dunn2-May-04 8:17 
GeneralRe: Copy Constructor Pin
Andrew Walker2-May-04 13:21
Andrew Walker2-May-04 13:21 
Generalnew programmer needs help Pin
pvparks2-May-04 7:04
pvparks2-May-04 7:04 
hi guys, i am trying to read in CD info from a file and put it into an array, using a CD class. I have been working here for about 6-8 hours trying to get the input file into an array. i just need some help starting it. It needs to read 15 15 rows with 6 columns in each row. Any help???

thx a bunch.....

#if !defined(microsoft)
#include <stdlib.h>
#define cls() system ("cls");
#endif

#include <iostream>
#include <iomanip>
#include <fstream>
#include <conio.h>
#include <cstring>
using namespace std;

class CD
{
private:
int numberID1;
char nameArtist[20];
int numSongs;
char genderArtist[10];
float cdPrice;
char artistLabel[25];
char cdArray[15];

public:

CD(); // default constructor

void getData(); //getData
void reportData();
void getkeyedData();
~CD(); //destructor

};

CD::CD()//constructor
{
numberID1 = 0;
nameArtist[0] = '\0';
numSongs = 0;
genderArtist[0] = '\0';
cdPrice = 0;
artistLabel[0] = '\0';
}

CD::~CD()//destructor
{

}


ifstream infile;
ofstream outfile;
ofstream errorlog;





int main ()
{

void instructions();
int menu();
void printCDList(const CD[]);

CD myCD;
CD CDList[50];

int i;

int data_amt;
int response;

outfile.open("cdlist.txt");
errorlog.open("errorlog.txt");
arraytest.open("arraytest.txt");




do


{
char filename[80];

infile.clear();
cout << "Please enter the name of the file with the CD information in it: ";
cin >> filename;
infile.open(filename, ios::in);
}
while (infile.fail());







instructions();

infile>>data_amt;


for(i=1; i<=data_amt; i++)
{
cout << "CD #" << i <<endl;
="" mycd.getdata();
="" getche();
="" cdlist[i]="myCD;
" }=""

="" getche();

="" response="menu();

switch(response)
{

//case" 1:="" mycd.idsort();
="" break;

="" case="" 2:="" mycd.artistsort();
="" break;

case="" 3:="" mycd.getkeyeddata();
="" 4:="" mycd.changeprice();
="" 5:="" mycd.reportdata();
="" cout="" <<="" "printing="" report......"="" endl;
="" "please="" hit="" enter="" to="" finish="" report"="" 6:="" break;



}


="" return="" 0;
}="" end="" of="" main
="" *

="" }
="" if(menuagain[0]="='Y'||menuAgain[0]=='y')
" {
="" menu();
="" else
="" "thank="" you="" for="" using="" this="" program.="" goodbye!"="" endl;

="" 0;
}

="" **********************************************************************
="" function="" name:="" instructions
="" purpose:="" explain="" the="" user="" what="" program="" will="" do
="" parameters:
="" input:
="" input="" &="" output:
="" value:
="" non-local="" variables="" used:
="" functions="" called:
="" **********************************************************************

*=""
void="" instructions()
{
="" "this="" allow="" information="" a="" cd="" from="" keyboard="" and="" file."="" "it="" accept:="" "="" "the="" upc="" code="" on="" cd,="" artist's="" name,="" gender="" artist,="" number="" songs="" price="" label="" that="" released="" cd"="" endl;


}

int="" menu()
{

="" int="" ans;
="" do="" cls();
="" cout<<"choose="" one="" following="" options:"<<endl;
="" cout<<"1.="" sort="" display="" list="" cd's="" by="" id="" number"<<endl;
="" cout<<"2.="" artists="" name"<<="" cout<<"3.="" new="" keyboard"<<endl;
="" cout<<"4.="" change="" cd's"<<endl;
="" cout<<"5.="" create="" report="" sorted="" cout<<"6.="" exit="" program"<<endl;
="" cin="">> ans;

}
while((ans<1)||(ans>6));

return ans;
}
GeneralRe: new programmer needs help Pin
Michael Dunn2-May-04 9:02
sitebuilderMichael Dunn2-May-04 9:02 
GeneralRe: new programmer needs help Pin
alex.barylski2-May-04 15:58
alex.barylski2-May-04 15:58 
GeneralRe: new programmer needs help Pin
Ryan Binns2-May-04 18:23
Ryan Binns2-May-04 18:23 
QuestionHow to I include functions from another project? Pin
jngonzalez2-May-04 6:28
jngonzalez2-May-04 6:28 
AnswerRe: How to I include functions from another project? Pin
valikac2-May-04 14:52
valikac2-May-04 14:52 
GeneralDeveloper Studio issue Pin
brdavid2-May-04 5:10
brdavid2-May-04 5:10 
GeneralRe: Developer Studio issue Pin
Chris Losinger2-May-04 5:33
professionalChris Losinger2-May-04 5:33 
GeneralRe: Developer Studio issue Pin
Renjith Ramachandran2-May-04 5:42
Renjith Ramachandran2-May-04 5:42 
GeneralRe: Developer Studio issue Pin
John R. Shaw2-May-04 5:43
John R. Shaw2-May-04 5:43 
GeneralRe: Developer Studio issue Pin
brdavid2-May-04 6:01
brdavid2-May-04 6:01 
GeneralVariable parameters and COleVariant Pin
brdavid2-May-04 5:07
brdavid2-May-04 5:07 
GeneralRe: Variable parameters and COleVariant Pin
Michael Dunn2-May-04 5:57
sitebuilderMichael Dunn2-May-04 5:57 
GeneralRe: Variable parameters and COleVariant Pin
brdavid2-May-04 6:25
brdavid2-May-04 6:25 
GeneralRe: Variable parameters and COleVariant Pin
Michael Dunn2-May-04 6:34
sitebuilderMichael Dunn2-May-04 6:34 
GeneralExport stl from a dll Pin
bsargos2-May-04 5:00
bsargos2-May-04 5:00 
GeneralRe: Export stl from a dll Pin
Joaquín M López Muñoz2-May-04 11:47
Joaquín M López Muñoz2-May-04 11:47 
GeneralRe: Export stl from a dll Pin
bsargos2-May-04 20:57
bsargos2-May-04 20:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.