Mar 8, 2008 at 4:49pm Mar 8, 2008 at 4:49pm UTC
Okay we have this simple school project where we take several XML northwind documents and do cout for specific information. Anyways for the OrderDetails and Products I used arrays to hold the information *seemed like it would be the easiest since i'm not that good with vectors* yet everytime i compile, it says i have no errors, but when i run it, it stops right at the OrderDetails function. Any ideas what might be screwing this up? :( Thanks
I couldn't fit all of the code so i just fit the part that was having the issue. If anyone wanted to take a look at the full thing i could email it. Anyone have any ideas?
void Record::setOrderDetails(){
findRecord("OrderID",getOrderID,"C:\\OrderDetails.xml");
for(int x = 0; x < numR; x++) ORDD[x] = M[x];
nORDD = numR;
}
void Record::printOrderDetails(){
int y = 0;
//string OrderIDD, ProductID;
//double UnitPrice, Quantity, Discount;
for(int x = 0; x < nORDD; x++){
for(it = ORDD[x]->begin(); it != ORDD[y]->end(); it++){
if(it->first == "OrderID"){OD[y]->OrderIDD = it->second;}
else if(it->first == "ProductID"){OD[y]->ProductID = it->second;}
else if(it->first == "UnitPrice"){OD[y]->UnitPrice = atof(it->second.c_str());}
else if(it->first == "Quantity"){OD[y]->Quantity = atof(it->second.c_str());}
else if(it->first == "Discount"){OD[y]->Discount = atof(it->second.c_str());}
//cout << it->first << ": " << it->second << "\n";
}
y++;
}
}
void Record::setProduct(){
nPRDD = 0;
for(int x = 0; x < nORDD; x++){
for(it = ORDD[x]->begin(); it != ORDD[x]->end(); it++){
if(it->first == "ProductID"){
findRecord("ProductID", it->second, "C:\\Products.xml");
for(int x = 0; x < numR; x++){
PRDD[nPRDD++] = M[x];
}
}
}
}
}
void Record::printProduct(){
int y = 0;
int g = 0;
//string ProductIDD, ProductName, SupplierID, CategoryID, QuantityPerUnit;
//double UnitPrice2, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued;
for(int x = 0; x < nPRDD; x++){
for(it = PRDD[x]->begin(); it != PRDD[x]->end(); it++) {
if(it->first == "ProductID"){PD[y]->ProductIDD = it->second;}
else if(it->first == "ProductName"){PD[y]->ProductName = it->second;}
else if(it->first == "SupplierID"){PD[y]->SupplierID = it->second;}
else if(it->first == "CategoryID"){PD[y]->CategoryID = it->second;}
else if(it->first == "QuantityPerUnit"){PD[y]->QuantityPerUnit = it->second;}
else if(it->first == "UnitPrice"){PD[y]->UnitPrice2 = atof(it->second.c_str());}
else if(it->first == "UnitsInStock"){PD[y]->UnitsInStock = atof(it->second.c_str());}
else if(it->first == "UnitsOnOrder"){PD[y]->UnitsOnOrder = atof(it->second.c_str());}
else if(it->first == "ReorderLevel"){PD[y]->ReorderLevel = atof(it->second.c_str());}
else if(it->first == "Discontinued"){PD[y]->Discontinued = atof(it->second.c_str());}
//cout << it->first << ": " << it->second << "\n";
}
y++;
}
cout << setw(12)<< "Product ID:" << setw(22) << "Product Name:" << setw(10) << "Quantity" << setw(12) << "Unit Price:" << setw(10) << "Discount:" << setw(14) << "Extended Price:" << "\n";
for(int x = 0; x < numR; x++){
//cout << setw(12) << PD[x]->ProductIDD << setw(22) << PD[x]->ProductName << setw(10) << OD[x]->Quantity << setw(12) << PD[x]->UnitPrice2 << setw(10) << OD[x]->Discount << setw(14) << ((OD[x]->Quantity * PD[x]->UnitPrice2)-((OD[x]->Quantity * PD[x]->UnitPrice2)*OD[x]->Discount)) << "\n";
}
}
void main(){
for(int x = 0; x < 80; x++)cout << "=";
cout << endl;
cout << "Welcome to the Northwind Consumer Database" << endl;
for(int x = 0; x < 80; x++) cout << "-";
cout << endl;
Record R1;
R1.setOrders();
R1.setCustomer();
R1.setOrderDetails();
cout << endl;
R1.printCustomer();
cout << endl;
R1.printOrders();
cout << endl;
R1.printOrderDetails();
cout << endl;
R1.setProduct();
R1.printProduct();
cout << endl;
}
Mar 8, 2008 at 4:51pm Mar 8, 2008 at 4:51pm UTC
Oh and my AIM is CoronaNights25, and so is my MSN If you wanna IM me. Thanks
Mar 9, 2008 at 2:25am Mar 9, 2008 at 2:25am UTC
hello CoronaNights25.
Are you using an IDE?
if yes does it have a debugger?
try debugging it.
you say it stops at OrderDetails function which one?