Click here to Skip to main content
15,925,206 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCreating Access 2000 database ! Pin
Hadi Rezaee7-Feb-02 9:38
Hadi Rezaee7-Feb-02 9:38 
GeneralRe: Creating Access 2000 database ! Pin
yamini7-Feb-02 23:41
yamini7-Feb-02 23:41 
GeneralRe: Creating Access 2000 database ! Pin
Hadi Rezaee8-Feb-02 8:14
Hadi Rezaee8-Feb-02 8:14 
GeneralMFC help Pin
redneckCoder7-Feb-02 9:18
redneckCoder7-Feb-02 9:18 
GeneralRe: MFC help Pin
Joaquín M López Muñoz7-Feb-02 9:36
Joaquín M López Muñoz7-Feb-02 9:36 
GeneralRe: MFC help Pin
Christian Graus7-Feb-02 9:42
protectorChristian Graus7-Feb-02 9:42 
GeneralRe: MFC help Pin
Nish Nishant7-Feb-02 10:28
sitebuilderNish Nishant7-Feb-02 10:28 
Generalinfinite loop Pin
7-Feb-02 8:39
suss7-Feb-02 8:39 
I am trying to get the user input by going to DOS and doing this:
C:\>windows>programNAme<inpu.txt
when i="" test="" every="" case="" sparately="" they="" all="" work="" just="" fine="" but="" when="" put="" thing="" together,="" don't="" know="" what="" happens?=""
="" Dead | X| =""
please="" tell="" me="" how="" to="" get="" out="" of="" this="" loop,="" if="" you="" can't="" find="" is="" wrong="" will="" be="" stuck="" forever.
<\pre=""> //And Do whatever is necessary to process it
do
{
switch (ch)
{
//***********************************************************************************
case 'C':
{
cin>>tempST>>tempIV;
tempStock->setStockTicker(tempST);
tempStocks->binarySearch( tempStocks->getMyStocks, 0, 14, tempST);

cout<<ch<<" "<<tempstock-="">getStockTicker()<<" "<<tempstock->getInitialValue()<<endl;

="" }break;="" ***********************************************************************************
="" case="" 'b':
="" {
="" cin="">>tempSS>>tempST>>tempNS;

//Here starts my binary search again
int low =0, mid, high= 9;
while (low <= high)
{
mid = (low + high)/2;
// here i create a temporary investor to hold data of Buyer
Investor tempInvestor = tempInvestors->getInvestor(mid);
tempAB = tempInvestor.getAccountBalance(); //AccountBalance Of Buyer
if (strcmp(tempInvestor.getSocialSecurity(),tempSS ) < 0) //this comparison is correct
low = mid + 1;
else if (strcmp(tempInvestor.getSocialSecurity(),tempSS) > 0)
high= mid - 1;
}

// Here i'm performing another binary search to look for the
// specific stock that has that same stockTicker
int lo =0, mi, hi=14;
int tempStockPrice;
while (lo <= hi)
{
mi = (lo + hi)/2;
*tempStock = tempStocks->getStock(mi);
tempStockPrice = tempStock->getCurStockPrice(); // storing the stockprice in tempStockPrice
if (strcmp(tempStock->getStockTicker(),tempST) < 0)
lo = mi + 1;
else if (strcmp(tempStock->getStockTicker(),tempST ) > 0)
hi = mi - 1;
}

if ( tempAB >= (tempStockPrice * tempNS))
{
tempTickerShare->setNumOfShares(tempNS);
tempTickerShare->setTickerSymbol(tempST);
tempInvestor->addTickerShare(tempTickerShare);
}

cout<< ch<<endl; <<"="" "<<tempinvestor-="">getSocialSecurity()<<" "<<temptickershare->getTickerSymbol() <<" "<< tempTickerShare->getNumOfShares()<<endl;
}break;=""

="" ***********************************************************************************
="" case="" 's':
="" {
="" cin="">>tempSS>>tempST>>tempNS;

//Here starts my binary search again
int low =0, mid, high=9;
while (low <= high)
{
mid = (low + high)/2;
// here i create a temporary investor to hold data of Seller
*tempInvestor = tempInvestors->getInvestor(mid);
if (strcmp((*tempInvestor).getSocialSecurity(),tempSS ) < 0)
low = mid + 1;
else if (strcmp((*tempInvestor).getSocialSecurity(),tempSS ) > 0)
high= mid - 1;
}

int lo =0, mi, hi=14;
while (lo <= hi)
{
mi = (lo + hi)/2;
tempTickerShare = tempInvestors->getInvestor(mid).getTickerShare(mi);
if (strcmp (tempST , tempTickerShare->getTickerSymbol()) < 0)
lo = mi + 1;
else if (strcmp(tempST , tempTickerShare->getTickerSymbol())> 0)
hi = mi - 1;
}

//Here i check whether the investor has enough shares to sell
if (tempNS <= tempTickerShare->getNumOfShares())
{
tempNS = tempTickerShare->getNumOfShares() - tempNS;
tempTickerShare->setNumOfShares(tempNS);
}
else
cout<< "Sorry don't have enough shares to sell"<<endl;

="" }break;="" cout<<="" ch="" <<"="" "<<tempinvestor-="">getSocialSecurity()<<" "<<temptickershare->getTickerSymbol() <<" "<< tempTickerShare->getNumOfShares()<<endl;
default:
="" {
="" cout<<"end="" of="" file.="" "<<endl;
="" }="" break;

="" }
="" }while(!cin.eof());
=""
="" delete="" tempstock;
="" tempstocks;
="" tempinvestor;
="" tempinvestors;
="" temptickershare;
}

<\pre="">


Hint: you can find the whole code in C2664
the question that i just asked
GeneralRe: infinite loop Pin
Joaquín M López Muñoz7-Feb-02 9:25
Joaquín M López Muñoz7-Feb-02 9:25 
GeneralRe: infinite loop Pin
7-Feb-02 9:41
suss7-Feb-02 9:41 
GeneralRe: infinite loop Pin
Joaquín M López Muñoz7-Feb-02 9:52
Joaquín M López Muñoz7-Feb-02 9:52 
Generalkeyboard system hook only works on focus Pin
Kuniva7-Feb-02 8:09
Kuniva7-Feb-02 8:09 
GeneralRe: keyboard system hook only works on focus Pin
Joaquín M López Muñoz7-Feb-02 8:48
Joaquín M López Muñoz7-Feb-02 8:48 
GeneralRe: keyboard system hook only works on focus Pin
Kuniva7-Feb-02 8:55
Kuniva7-Feb-02 8:55 
GeneralRe: keyboard system hook only works on focus Pin
Joaquín M López Muñoz7-Feb-02 9:32
Joaquín M López Muñoz7-Feb-02 9:32 
GeneralRe: keyboard system hook only works on focus Pin
Rickard Andersson207-Feb-02 9:06
Rickard Andersson207-Feb-02 9:06 
GeneralAfxThrowOleDispatchException not working for me .. Pin
vishalsp7-Feb-02 7:47
vishalsp7-Feb-02 7:47 
GeneralRe: AfxThrowOleDispatchException not working for me .. Pin
Joaquín M López Muñoz7-Feb-02 8:23
Joaquín M López Muñoz7-Feb-02 8:23 
GeneralRe: AfxThrowOleDispatchException not working for me .. Pin
vishalsp7-Feb-02 10:56
vishalsp7-Feb-02 10:56 
GeneralRe: AfxThrowOleDispatchException not working for me .. Pin
Joaquín M López Muñoz7-Feb-02 12:03
Joaquín M López Muñoz7-Feb-02 12:03 
GeneralRe: AfxThrowOleDispatchException not working for me .. Pin
vishalsp8-Feb-02 2:06
vishalsp8-Feb-02 2:06 
GeneralRe: AfxThrowOleDispatchException not working for me .. Pin
vishalsp11-Feb-02 4:25
vishalsp11-Feb-02 4:25 
GeneralLoading Problem Pin
Sonu Kapoor7-Feb-02 7:18
Sonu Kapoor7-Feb-02 7:18 
GeneralRe: Loading Problem Pin
Joaquín M López Muñoz7-Feb-02 7:53
Joaquín M López Muñoz7-Feb-02 7:53 
GeneralRe: Loading Problem Pin
Sonu Kapoor7-Feb-02 8:40
Sonu Kapoor7-Feb-02 8:40 

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.