Hello! I'm new to the site and I'm having trouble compiling my program. I was hoping that somebody can take a look at my code and try to point me in the right direction. It's a charge account program that consist of using a repetition control structure. Here are the instructions:

a) customers name
b) account # (an integer)
c) Balance at the beginning of the month
d) Total items charged
e) Total of all payment credits applied
f) Allowed credit limit

The program should input each of these facts, and calculate the customer’s new balance. It should not allow the user to enter a negative value for either the charges or the credits. If a negative value is entered for any of these two variables, a warning should be displayed that the user cannot proceed until the user enters a valid value. Next, the program should evaluate the customer’s new balance, to determine if it exceeds their credit limit. If this happens, an over the limit charge of $50 is imposed and display a message. The program should then display the customer’s name, account number, credit limit and new balance. If the user enters ‘y’, the program should prompt and receive entries for the next customer and perform the same calculations. If user enters ‘n’, the program should print a report and then terminate.

Here is my code:

#include "stdafx.h"


#using <mscorlib.dll>


using namespace System;


int _tmain()
{
int cust_name,        // Customer's Name
acct_number,      // Account Number
total,                    // Sum of customers
cust_counter,     // Number of Customers counted
yes = 0,          // Prompt and Receive entries
no = 0,       // Print a summary report
result,



double beg_balance,    // Beginning Balance
new_balance,          // New Balance
total_charges,            // Total Charges
total_credits,             // Total Credits
cred_limit;       // Allowed Credit Limit


// initialization phase


total = 0;
cust_counter = 0;


// Processing Phase


Console::Write(S" Enter Customer's Name: ");
cust_name = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Account Number: ");
acct_number = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Beginning Balance: ");
beg_balance = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Total Charges: ");
total_charges = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Total Credit: ");
total_credits = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Credit Limit: ");
cred_limit = Int32::Parse(Console::ReadLine());


// Enter Loop


while(new_balance >= 0);


{
Console::Write(S" Enter New Balance: ");
new_balance = Int32::Parse(Console::ReadLine());


new_balance = beg_balance + total_charges -
total_credits;


cust_counter = new_balance + 1;


}  //end while


if (cust_counter >= 0);


{


Console::WriteLine(S" Credit Limit Doesn't Exceed
Limit ");


} //end if


else


Console::WriteLine(S" Warning: Credit Limit
Exceeded!!! \n Over the limit charge of $50
imposed ");


while


{
Console::Write(S" Enter Customer's Name: ");
cust_name = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Account Number: ");
acct_number = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Beginning Balance: ");
beg_balance = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Total Charges: ");
total_charges = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Total Credit: ");
total_credits = Int32::Parse(Console::ReadLine());


Console::Write(S" Enter Credit Limit: ");
cred_limit = Int32::Parse(Console::ReadLine());


Console::WriteLine(S" Is there another customer to
be processed? (1=yes, 2=no): ");
result = Int32::Parse(Console::ReadLine());


// if result is 1, increment cust_name; if-else end while


if (result == 1)
yes = yes + 1;
else
no = no + 1;


// increment counter so loop can terminate


cust_name = cust_name + 1;


} // end while


// termination phase


Console ::WriteLine(S" \n Yes: {0} \n No: {1} ", yes.ToString(), no.ToString());


return 0;
}

If you can help me with this I would appreciate it ;)

Welcome. A couple things to help you out. First, as you can tell by looking at your post, posting code to bulletin boards frequently destroys the indenting used to make your code more readable. Most boards offer a fix for this, as does this board. You can read about it in the FAQ, though in short it just means adding the line [ code ] before your code and the line [ /code ] after your code (rfemove the spaces between the square brackets and the word code! when you do it). Many contributors won't read code that isn't "fixed".

Second, posting a full program and asking for help without indicating what's wrong is likely to be ignored. Try to indicate whether it won't compile, crashes when run, provides wrong output, results in an error message (include the message and what line is indicated as the culprit by your compiler!). Even better, try to distill the problem down to a prototype and post that!

So, as a start:
1) repost using the code tags
2) indicate a specific question
3) describe the problem the best you can
4) reduce any code to a prototype that causes the same problem if you can,
5) list any error messages and highlight what lines your compiler indicates is the problem

ok thank you. I will repost it

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.