
Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
|
|
||
For first try use this:
At least this works... |
what's with you and _TCHAR? that's not a type you should be using.
and the error in the original program is that the 2 functions do not match signatures
CustomerRecord is not the same as CustomerRecord[]
For first try use this:
| Code: |
|
// xxxx.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <string> using namespace std; struct CustomerRecord { string name; int account_number; double balance; }a[2]; void read_y(CustomerRecord*); void print_y(CustomerRecord*); int main(int argc, _TCHAR* argv[]) { int c; read_y(a); print_y(a); cin >> c; return 0; } void read_y(CustomerRecord* a) { for (int i=0; i<2; i++) { cout << "Name : "; cin >> a[i].name; cout << "Account Number : "; cin >> a[i].account_number; cout << "Balance : "; cin >> a[i].balance; } } void print_y(CustomerRecord* a) { for (int i=0; i<2; i++) { cout << "Name : " << a[i].name << endl; cout << "Account Number : " << a[i].account_number << endl; cout << "Balance : " << a[i].balance <<endl; } } |
At least this works...
| what's with you and _TCHAR? that's not a type you should be using. |
It could be some sort of predefined constant? Though I agree, it doesn't look like anything that I've come across before.
what's with you and _TCHAR? that's not a type you should be using. and the error in the original program is that the 2 functions do not match signatures CustomerRecord is not the same as CustomerRecord[] |
Hmmm, these things gets automatically generated by Visual Studio...? Why shouldnt that be used? If there some issue in using TCHAR please tell me.
I know, I altered the solution a bit....but for me it works, I compiled it and so I didnt check it any further. It should only be an very little alternative.
You can replace *a by a[]...wheres the problem (both dereferences the field a)? Also the name is not important (declaration and definition are in accordance).
ADD: Ah, one thing: I know that you dont have to use the paramters in main. But I think its helpful to have access to the parameters you start the *.exe with. I usually do not mention this...
TCHAR mean CHAR for ANSI and WCHAR for Unicode.
| Hmmm, these things gets automatically generated by Visual Studio...? Why shouldnt that be used? If there some issue in using TCHAR please tell me. |
it's not a standard type, and even so you should be using TCHAR not _TCHAR
1 to 7 of 7