For some reason, this very basic code will compile with no errors in Visual C++, but gives errors in XCode. I will need to know why, in order to continue working in Xcode for my Computer Science class.
#include <iostream>
#include <string>
using namespace std;
struct acct { // bank account data
int num; // account number
string name; // owner of account
float balance; // balance in account
};
int main() {
acct account;
cout << "Enter new account data: " << endl;
cout << "Account number: ";
cin >> account.num;
cout << "Account name: ";
cin >> account.name;
cout << "Account balance: ";
cin >> account.balance;
return 0;
}
It gives two errors, one saying that it expected ';' before account (after main is declared), and the second that account was not declared for cin >> account.num;