c# - Print from Structures -


    using system;  enum accountstate         {             new,             active,             underaudut,             frozen,             closed         } ;    struct account         {             public accountstate state;             public string name;             public string adress;             public int accountnumber;             public int balance;             public int overdraft;         } ;     class bankprogram     {         public void printaccount(account a)         { console.writeline("name: " + a.name);           console.writeline("address: " + a.adress);           console.writeline("balance: " + a.balance); }         public static void main()         {             account robsaccount;             robsaccount.state = accountstate.active;             robsaccount.name = "rob miles";             robsaccount.adress = "his house";             robsaccount.accountnumber = 1234;             robsaccount.balance = 0;             robsaccount.overdraft = -1000;             console.writeline("name : " + robsaccount.name);             console.writeline("balance : " + robsaccount.balance);             printaccount(account robsaccount);         }  } 

hallo. want print information command printaccount(account robsaccount); compiler says 1) ) expected (line 41) 2) invalid expression term ')' (line 41)
3) ; expected (line 41) line 41 command --> printaccount(account robsaccount); im working in c#

when declare method, in form of:

[modifiers] return-type-or-void method-name([parameter-type parameter-name[, parameter-type2 parameter-name2[, ...]]]) 

in case:

modifiers return-type-or-void method-name  parameter-type parameter-name ======    ====                ============ =======        = public    void                printaccount(account        a) 

when call method, in form of:

[resultvariable = ] method-name([argument[, argument2[, ...]]]) 

with code:

printaccount(account robsaccount); 

you're trying call method printaccount. method declaration has type specified, when calling it, don't have again:

printaccount(robsaccount); 

as second error:

an object reference required non-static field, method, or property 'bankprogram.printaccount

that text occurs 32000 times on stack overflow, i'm sure can find solution that.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -