- Upvotes Received
- 1
- Posts with Upvotes
- 1
- Upvoting Members
- 1
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
10 Posted Topics
[code] FILE *infile; infile = fopen("coords1.txt", "r"); int num = 0; for(int num1 = 0; num1 < 5; num1++) { for(int num2 = 0; num2 < 4; num2++) { for(int num3 = 0; num3 < 3; num3++) { fscanf(infile, "%f", &num ); targetCoords[num1][num2][num3] = num; } } } [/code] I'm … | |
[code] void writingTransactionToFile(string transaction) { string temp; int test; ifstream myfile("transactionlog.txt"); ofstream tempfile ("tempfile.txt", ios::app); if (tempfile.is_open()) { tempfile << transaction; if(myfile.is_open()) { while(!myfile.eof()) { getline(myfile,temp); cout << temp; tempfile << temp << endl; } } else { cout << "Unable to open file."; } tempfile.close(); myfile.close(); } else cout … | |
Re: You aren't storing the items anywhere? All you are doing is increasing the number of items bought each time. And printing the latest item off. If you buy item 5, 6 and 1. You need to store this somewhere, maybe in another array? Then print out this array. Not the … | |
Main.cpp This is where the problem lies. [code] #include <iostream> #include <time.h> #include <math.h> #include <iomanip> #include "LinkedList.h" #include <fstream> #include <string> using namespace std; void main(void) { LinkedList Customers; Customer* newCustomer; Entry* test; int i = 0; newCustomer = new Customer(1001, "Olly", "07/10/1988", "17 Bob Lane", "Hobbs Road", "UB3 … | |
Re: Why don't you just declare it in main? (like you have with x and y) | |
Re: [QUOTE=Cwapface;739772]ughhh...okay, class D is now able to access class A's function (yay!), but now it doesn't seem to be able to access the private members. Why? I thought when you used friend operator, it allows access to private members..?[/QUOTE] Not sure, change them to protected should work though. | |
Re: [QUOTE=elsa87;738841]i was trying..but the thing is that im weak at programming.. could u plz point me to my mistakes and help me remove the errors?[/QUOTE] He already has. You can't declare a function inside a function. | |
[code] transactionInfo = date + " - " + _strtime( time ) + "New Customer - 1001 - Olly"; [/code] Ok so I've been trying to find it everywhere in C++ reference guides but it seems I can't do the above ^^ (says I cannot add 2 pointers). date is … | |
[code] int numOfMonths = numOfYears * 12; float monthlyRepayments; float actualRate = (rate/100)/12; //monthlyRepayments = (borrowAmount*(pow((1+actualRate),numOfMonths))*actualRate)/((pow((1+actualRate),numOfMonths))-1); monthlyRepayments = (100000 * (pow((1+actualRate),180) * actualRate))/((pow((1+actualRate),180))-1); [/code] Ok this is the actual equation: (100000*(1+A1)^180*A1)/((1+A1)^180-1) btw A1 =0.06/12 So the commented line is original one I tried, didn't work. So I tried just putting … | |
Btw below is the key parts of my code - not all as there are loads of lines: [CODE] //main.cpp #include <iostream> #include "Customer.h" using namespace std; void displayMainMenu(); int enterMainChoice(); void displayAccountMenu(); int enterAccountChoice(); int enterCustomerID(); Customer createCustomer(); void main(void) { unsigned short numberOfCustomers = 0; Customer *Customers[10]; *Customers[numberOfCustomers] … |
The End.