Click here to Skip to main content
15,921,295 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDownload XskinExp for 3ds max7 Pin
akira322-Apr-05 12:58
akira322-Apr-05 12:58 
GeneralXSkinExp for 3ds max7 Pin
akira322-Apr-05 12:29
akira322-Apr-05 12:29 
GeneralInheritance Question Pin
sacoskun2-Apr-05 7:21
sacoskun2-Apr-05 7:21 
GeneralRe: Inheritance Question Pin
Michael Dunn2-Apr-05 7:33
sitebuilderMichael Dunn2-Apr-05 7:33 
GeneralA question to save html file Pin
Anonymous2-Apr-05 6:25
Anonymous2-Apr-05 6:25 
GeneralRe: A question to save html file Pin
Michael Dunn2-Apr-05 7:38
sitebuilderMichael Dunn2-Apr-05 7:38 
GeneralRe: A question to save html file Pin
Anonymous2-Apr-05 13:33
Anonymous2-Apr-05 13:33 
GeneralCan't get the data from a loaded vector Pin
Larry Mills Sr2-Apr-05 3:49
Larry Mills Sr2-Apr-05 3:49 
I cannot get the data from my vector after I’ve loaded it! It shows in debug that the vector is loading, but I can’t get the data it has loaded out of the vector.
Here’s the pertinent code:

#pragma warning(disable: 4786)

#include "stdafx.h"
#include "Well.h"
#include "Leases.h"
//#include "stdafx.h"
//#include "stdafx.h"

using std::cout;
using std::endl;

int main(int argc, char* argv[])
{
cout << "Hello World" << endl << endl;

CLease cleases;
/*
int i = 0;
for(i=0; i<6; i++)
{

cout << nSerialNum << strUseMap << " " << strWellDescription << " " << strWellName << endl; endl;
db::it++;
}
*/
return 0;
}


/* This class will be included in the vector and then saved to the file
*/


#if !defined AFX_WELL_H__
#define AFX_WELL_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "stdafx.h"
#include <string>
//#include <vector>
//#include "Leases.h"
//#include <string>

using std::string;


class CWell {
public:
string& GetWellName2();
string& GetWellDescription2();
string& GetUseMap2();
long GetSerialNum2();
string GetWellName(string& str);
string GetWellDescription(string& str);
string GetUseMap(string& str);
long GetSerialNum(long& SN);
CWell();
virtual ~CWell();
void Initialize();
protected:
string strWellName;
string strWellDescription;
string strUseMap;
long nSerialNum;

// Fuctions of class
// string GetWellName();
// string GetWellDescription();
// string GetUseMapLocation();
// long GetSerialNumber();
};



#endif // !defined AFX_WELL_H__

#include "stdafx.h"
//#include <vector>
#include "Well.h"
//#include <string>

CWell::CWell() {
// This class holds the data for each well
strUseMap = "";
strWellDescription = "";
strWellName = "";
nSerialNum = 0;

}

CWell::~CWell() {

}


// end class

void CWell::Initialize()
{

// Initialize the well class members to 0/NULL
nSerialNum = 0;
strUseMap = "";
strWellDescription = "";
strWellName = "";
}

long CWell::GetSerialNum(long& SN)
{
return nSerialNum = SN;
}

string CWell::GetUseMap(string& str)
{
return strUseMap = str;
}

string CWell::GetWellDescription(string& str)
{
return strWellDescription = str;
}

string CWell::GetWellName(string& str)
{
return strWellName = str;
}

long CWell::GetSerialNum2()
{
return (long)nSerialNum;
}

string& CWell::GetUseMap2()
{
return strUseMap;
}

string& CWell::GetWellDescription2()
{
return strWellDescription;
}

string& CWell::GetWellName2()
{
return strWellName;
}

#if !defined AFX_LEASES_H__
#define AFX_LEASES_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "Well.h"

#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
//#include "Well.h"

using std::vector;
using std::iterator;

class CWell;

class CLease {

public:
CLease();
~CLease();


protected:
int nNumOfWells;
std::vector<cwell> db;
std::vector<cwell>::iterator it;
CWell cwells;

};

#endif // end class definition

#include "stdafx.h"
#include "Leases.h"
#include "stdlib.h"

using std::cout;
using std::endl;

CLease::CLease()
{


//CWell cwells = new CWell;
cwells.Initialize();

// For Testing Only : delete after testing is complete
long SN, SN2 = 0;
string str, str2, str3 = "";
int i = 0;
for(i=0; i< 6; i++)
{
switch(i)
{
case 0: SN = 0; SN2 = cwells.GetSerialNum(SN);
str = "1st Use Map"; cwells.GetUseMap(str); str = "";str2 = "";
str = "1st WellDescription"; cwells.GetWellDescription(str); str = "";str2 = "";
str = "1st Well Name"; cwells.GetWellName(str); str = "";str2 = "";
break;
case 1: SN = 1; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "2nd Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "2nd WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "2nd Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 2: SN = 2; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "3rd Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "3rd WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "3rd Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 3: SN = 3; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "4th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "4th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "4th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 4: SN = 4; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "5th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "5th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "5th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
case 5: SN = 5; SN2 = cwells.GetSerialNum(SN); SN = 0;
str = "6th Use Map"; str2 = cwells.GetUseMap(str); str = "";str2 = "";
str = "6th WellDescription"; str2 = cwells.GetWellDescription(str); str = "";str2 = "";
str = "6th Well Name"; str2 = cwells.GetWellName(str); str = "";str2 = "";
break;
} // end switch

db.push_back(cwells);
//SN = /*dynamic_cast<long> (*/cwells.GetSerialNum2();
//str = /*dynamic_cast<char> (*/cwells.GetUseMap2();
//str2 = /*dynamic_cast<char> (*/cwells.GetWellDescription2();
//str3 = /*dynamic_cast<char> (*/cwells.GetWellName2();
//cout << SN << str << " " << str2 << " " << str3 << endl;
//cout << *it << endl;
it++;
SN = 0;
str = "";
str2 = "";
str3 = "";
//char ch;
//getc(ch);
/* for(i=0; i<6; i++)
{

cout << nSerialNum << strUseMap << " " << strWellDescription << " " << strWellName << endl; endl;
db::it++;
}
*/
} // end for
// now check the container
CWell well;
for(it=db.begin(); it != db.end(); it++)
{
SN = /*dynamic_cast<long> (*/well.GetSerialNum2();
str = /*dynamic_cast<char> (*/well.GetUseMap2();
str2 = /*dynamic_cast<char> (*/well.GetWellDescription2();
str3 = /*dynamic_cast<char> (*/well.GetWellName2();
cout << SN << " " << str << " " << str2 << " " << str3 << endl;
//cout << *it << endl;
SN = 0;
str = "";
str2 = "";
str3 = "";
} // end for
}


CLease::~CLease()
{

}


C++ is my favorite programming language
Generalclipboard Pin
Stirfie2-Apr-05 1:50
Stirfie2-Apr-05 1:50 
GeneralRe: clipboard Pin
Tareq Ahmed Siraj2-Apr-05 5:25
Tareq Ahmed Siraj2-Apr-05 5:25 
GeneralRe: clipboard Pin
Stirfie4-Apr-05 1:19
Stirfie4-Apr-05 1:19 
GeneralRe: clipboard Pin
David Crow4-Apr-05 3:24
David Crow4-Apr-05 3:24 
GeneralRe: clipboard Pin
Tareq Ahmed Siraj4-Apr-05 19:48
Tareq Ahmed Siraj4-Apr-05 19:48 
GeneralRe: clipboard Pin
Stirfie4-Apr-05 23:09
Stirfie4-Apr-05 23:09 
GeneralSolution Explorer Pin
NewbieStats1-Apr-05 23:40
NewbieStats1-Apr-05 23:40 
GeneralTo find used space in folders or path without searching files Pin
inbakumar.G1-Apr-05 23:18
inbakumar.G1-Apr-05 23:18 
Generalhelp Pin
stammer1-Apr-05 23:04
stammer1-Apr-05 23:04 
GeneralRe: help Pin
Alexander M.,2-Apr-05 3:11
Alexander M.,2-Apr-05 3:11 
GeneralRe: help Pin
stammer2-Apr-05 14:07
stammer2-Apr-05 14:07 
GeneralRe: help Pin
ThatsAlok2-Apr-05 18:11
ThatsAlok2-Apr-05 18:11 
GeneralRe: help Pin
stammer3-Apr-05 13:53
stammer3-Apr-05 13:53 
GeneralRe: help Pin
Christian Graus2-Apr-05 10:35
protectorChristian Graus2-Apr-05 10:35 
GeneralRe: help Pin
stammer2-Apr-05 14:14
stammer2-Apr-05 14:14 
GeneralRe: help Pin
Christian Graus3-Apr-05 12:51
protectorChristian Graus3-Apr-05 12:51 
GeneralRe: help Pin
stammer3-Apr-05 14:12
stammer3-Apr-05 14:12 

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.