What did i do wrong here in this code?

Hey guys, i am having trouble understanding the for concept.
This is the algorithm the teacher posted and this is the code I try to implement although i am sure its not correct... I would really appreciate it if u can let me know what the true code is and explain it to me. thank you so much

// Purpose:
// To create an application that gets sales transaction data for the Homestead Furniture Store.
// Start
// Declarations
// number acctNum
// string firstName
// string lastName
// number purchasePrice
// number payment
//
// output "Please enter account number: "
// input acctNum
// output "Please enter customer's first name: "
// input firstName
// output "Please enter customer's last name: "
// input lastName
// output "Please enter purchase price: "
// input purchasePrice
//
// payment = purchasePrice / 12
// output "Customer First Name: ", firstName
// output "Customer Last Name: ", lastName
// output "Account Number: ", acctNum
// for count = 1 to 12
// output "Payment Number ", count, ": $" , payment
// endfor
// Stop

#include <iostream>
#include <cstdlib>
using namespace std;
int main( )
{
int acctNum;
string firstName;
string lastName;
int purchasePrice;
int payment;
cout << “Please enter account number: “ ;
cin >> account number;
cout << “Please enter customer’s first name: “
cin >> firstName;
cout << “Please enter purchase price: “
cin >> purchasePrice;

payment= purchasePrice / 12;
cout <<“Customer First Name: “ << firstName <<endl;
cout <<”Customer Last Name: “ <<lastName <<endl;
cout << “Account Number: “ <<acctNum<<endl;


for(count = 1; count <=12; count++)
cout<<”Payment Number “
count = count+1
output count
}


system(“PAUSE”);
return 0;
}
1) Please use code tags when posting code, to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/

2) "not correct" isn't a helpful description. What, specifically, are you having a problem with? Why do you think it's not correct? What behaviour is it exhibiting, that differs from the behaviour you want?
Errors i am getting are as follows after i complied and ran

In function 'int main()':
[Error] 'account' was not declared in this scope
[Error] 'count' was not declared in this scope
[Error] stray '\224' in program
[Error] expected declaration before '}' token
cin >> account number;

This is illegal. It looks like you're trying to store the input value in a variable called "account number", but (a) you can't have a variable with a space in the name, so that's not a legal name, and (b) even if it were legal, you haven't declared it anywhere.

Did you mean "acctNum", which is a variable you have actually declared?

Similarly, you haven't declared a variable called "count".

Please edit your OP to use code tags for your code, to make it more readable.
Topic archived. No new replies allowed.