I am confused as to why I am getting this on GCC. I have all the flies in the same directory, I have have closed the compiler and reopened it and I am still get this error. I am getting oters too but I am sure that can be fixed if I can get rid of this include issue
phillipeharris 0 Newbie Poster
//***************************************************************
// TITLE: Contributor
// FILEInContrib: Contributor.cpp
// PREPARED FOR: CS230 Section <section number>
// PROGRAMMER(S): < Phillip Harris>
// DEVELOPMENT DATE: < 07/09/08>
// COMPILER USED: <MS visual studio 2005>
// TARGET PLATFORM: < WIN XP >
//================================================================
// PROJECT FILES
// contributor.h, contributor.cpp, Lab1.cpp
//================================================================
// REVISION HISTORY
// DATE PROGRAMMER DESCRIPTION OF CHANGES MADE
// <07/08/08 Phil Harris Original >
//================================================================
#include <iostream>
#include <string>
#include <iomanip>
#include "Contributor.h"
using namespace std;
///c-tor implementation
int num =1;
Contributor::Contributor()
{
//cout<<endl<<"Test #1a - This is the default constructor"<<endl;
//this sets the variables to a defaul value
Name = "";
Contribution = 0.0f;
Sex = None;
IDKey = 0;
}
//copy C-tor
Contributor::Contributor(string InContrib, double InContribution, Gender InSex, int InIDKey)
{
Name= InContrib;
Contribution= InContribution;
Sex = InSex;
IDKey= InIDKey;
}
Contributor::Contributor(const Contributor &CCContrib)
{
Name = CCContrib.Name;
Contribution= CCContrib.Contribution;
Sex = CCContrib.Sex;
IDKey = CCContrib.IDKey;
}
ostream &operator <<(ostream & Out,Contributor &InContrib)
{
Out<<endl<<num<<"\tName of the Contributor? " <<endl;
Out<<"\tName: " <<InContrib.Name <<endl;
Out<<"\tContribution: "<<InContrib.Contribution<<endl;
Out<<"\tID Number: " <<InContrib.IDKey<<endl;
Out<<"\tGender: ";
switch (InContrib.Sex)
{
case Male: Out<<" Male ";break;
case Female: Out<<" Female ";break;
default: Out<<"NONE";break;
}
num++;
Out<<endl;
return Out;
}
/*istream &operator >> (istream &In,Contributor &InContrib)
{
int SelSex = 0;//selection of gender
In.clear();
In.ignore(In.rdbuf()->in_avail(), '\n');
cout<<"\tEnter Contirbutors Name: ";
getline(In,InContrib.Name);
cout<<"\tEnter the amount of "<<InContrib.Name <<"'s contribution ";
In>>InContrib.Contribution;
cout<<"\tNow Enter an ID# for "<<InContrib.Name<<" ";
In>>InContrib.IDKey;
cout<<"\twhat is "<<InContrib.Name<<"'s Gender? "<<endl;
cout<<"\t1. Male. \n\t2. Female \n\t3. None\n\n";
In >> SelSex;
switch(SelSex)
{
case 1: SelSex = Male; break;
case 2: SelSex = Female; break;
case 3: SelSex = None; break;
}
return In;
}
*/
Contributor &Contributor::operator = (const Contributor & RtSide)
{
if(this != &RtSide)
{
Name = RtSide.Name;
Contribution = RtSide.Contribution;
Sex = RtSide.Sex;
IDKey = RtSide.IDKey;
}
return *this;
}
bool Contributor::operator <(const Name & RtSide)
{
return (Name <RtSide.Name);
}
bool Contributor::operator >(const Name & RtSide)
{
return (Name <RtSide.Name);
}
bool Contributor::operator ==(const Contributor & RtSide)
{
return ((Name == RtSide.Name)&&(Contribution==RtSide.Contribution)&&(Sex== RtSide.Sex));
}
bool Contributor::operator !=(const Contributor & RtSide)
{
return((Name != RtSide.Name)||(Contribution!=RtSide.Contribution)||(Sex != RtSide.Sex));
}
// TITLE: Contributor
// FILENAME: Contributor.h
// PREPARED FOR: CS230 Section <section number>
// PROGRAMMER(S): < Phillip Harris>
// DEVELOPMENT DATE: < 07/09/08>
// COMPILER USED: <MS visual studio 2005>
// TARGET PLATFORM: < WIN XP >
//================================================================
// PROJECT FILES
// contributor.h ,contributor.cpp, Lab1.cpp
//================================================================
// REVISION HISTORY
// DATE PROGRAMMER DESCRIPTION OF CHANGES MADE
// <07/08/08 Phil Harris Original >
//
//================================================================
// PROCESS THIS FILE ONLY ONCE PER PROJECT
#ifndef CONTRIBUTOR_H
#define CONTRIBUTOR_H
#include <iostream>
#include <string>
using namespace std;
//================================================================
//CONSTANT DEFINITIONS
enum Gender {Male=0, Female, None};
class Contributor
{
friend ostream &operator <<(ostream & Out,Contributor &InContrib);
friend istream &operator >>(istream & In, Contributor &InContrib);
public:
Contributor();
Contributor(string InContrib, double InContribution, Gender inSex, int InIDKey);
Contributor(const Contributor &CCContrib);
//~Contributor(){cout<<"Test #1b - This is the Contributor destructor. "<<endl;}
/////Overloaded Operators
Contributor &operator=(const Contributor & RtSide);
bool operator <(const Contribution & RtSide);
bool operator >(const Contribution & RtSide);
bool operator ==(const Contributor & RtSide);
bool operator!=(const Contributor & RtSide);
bool insertNode(Contributor i);
// Contributor intData;
private:
string Name;
double Contribution;
Gender Sex;
int IDKey;
};
#endif
#include<iostream>
#include<string>
#include<list>
#include<cstdlib>
#include<stack>
#include<ctime>
#include "Contributor.h"
using namespace std;
/////////////////////// Making all the list and stacks
int main()
{
int num= 1;
list <Contributor> M_list; //make a list of contributors
list <Contributor>::iterator M_ITR = M_list.begin();
list <Contributor> F_list;
list <Contributor>::iterator F_ITR = F_list.begin();// this is initializes the iterator
stack <Contributor> F_stack;// make a stack for the male and female
stack <Contributor> M_stack;
stack <Contributor>LHS_stack;//this make the left side of the table
stack <Contributor>RHS_stack;//this makes the right side of the table
///////// ///////professor Thors contributor generator //// /////////
srand ((unsigned) time (NULL));
for (int counter=0; counter<100;counter++)
{
double Con=rand()% 1000;
int Sex=rand()%10;
if(Sex>4)
{
Contributor Dude("Male", Con, Male, 1234);
M_list.insert(M_ITR, Dude);
}else{
Contributor lady("Lady", Con, Female, 1234);
F_list.insert(F_ITR, lady);
}
}
////////////////// shows the lists //////////////////////////
//M_list.sort();
//F_list.sort();
for(M_ITR = M_list.begin();M_ITR != M_list.end();M_ITR++)
{
M_stack.push(*M_ITR);
} //********************//
for(F_ITR = F_list.begin();F_ITR != F_list.end();F_ITR++)
{
F_stack.push(*F_ITR);
}
cout <<"The size of M_stack is "<<(int)M_stack.size()<<endl;
cout <<"The size of F_stack is "<<(int)F_stack.size()<<endl;
////////////////////////////////////////////////////////////////////
if(F_stack.empty())
{
cout<<"F_Stack is empty"<<endl;
}else{
cout<<"F_Stack has something in it"<<endl;
cout<<"The size of the Female stack is "<<F_stack.size()<<endl;
}
//***********************
if(M_stack.empty())
{
cout<<"M_Stack is empty"<<endl;
}else{
cout<<"M_Stack has something in it"<<endl;
//cout<<"The size of the Male stack is "<<M_stack.size()<<endl;
}
///////////////////////////////////////////////////////////////////////
cout<<" this is the RHS stack (male)"<<endl;
while (!M_stack.empty())
{
RHS_stack.push(M_stack.top());
M_stack.pop();
cout << " " << M_stack.top();
}
cout << " the size of this is M_stack(" << RHS_stack.size()<< ")"<< endl<<endl;
// ***************************** //
cout<<" this is the LHS stack (Female)"<<endl;
while (!F_stack.empty())
{
LHS_stack.push(F_stack.top());
F_stack.pop();
cout << " " << F_stack.top();
}
cout<<"this is from the top of the RHS pile "<<RHS_stack.top()<<endl<< endl;
if(LHS_stack.empty())
{
cout<<"LHS stack is empty" <<endl;
}else{
cout<<"LHS_stack has something in it and the size it "<< LHS_stack.size()<<endl;
} //*************************//
if(RHS_stack.empty())
{
cout<<"RHS stack is empty" <<endl;
}else{
cout<<"RHS_stack has something in it and the size it "<< RHS_stack.size()<<endl;
}
////////////////////////////////////////////////////////////////////////
cin >>num;// this is for the gcc compiler
return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
what errors? Post a couple of them.
phillipeharris 0 Newbie Poster
what errors? Post a couple of them.
hey Dragon . I figured out what I did wrong as soon as I pushed the submit butt. Stupid mistake and I have to walk away from it to see what I did. but thanks for your help. I am sure that I will be posting more now that I am gettting back into c++.
ilikelampard 0 Newbie Poster
If you have posted it that time, it would have helped me today. You are not the only one who is making stupid mistakes on this earth... :)). So, dont be shy.. and plz give complete information.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.