Monday, July 27, 2009

C++ programming help?

and here's the shortened version....





else if (choice == 7)


{


cout%26lt;%26lt;"You have chosen Transfer Funds.\n";


int SSN, transfer_funds,


float transfer;


cout%26lt;%26lt;"Enter social security number: ";


cin%26gt;%26gt;SSN;


cout%26lt;%26lt;"Enter 1 to transfer from checking to savings or 2 the transfer from savings to checking: ";


cin%26gt;%26gt;transfer_funds;


cout%26lt;%26lt;"Enter the transfer amount: $";


cin%26gt;%26gt;transfer;


int c_index;


int s_index;


int i;


for (i=0; i%26lt;cust_index+1; i++)


{


if (bank[i].ssn == SSN)


{


if (bank[i].act_type == 1)


{


i=c_index;


}


else


{


i=s_index;


}


}


}

C++ programming help?
Also, why would you assign values to 'i' in the for() loop?


They'll be overwritten....





for (i=0; i%26lt;cust_index+1; i++)


{


if (bank[i].ssn == SSN)


{


if (bank[i].act_type == 1)


{


i=c_index;


}


else


{


i=s_index;


}


}


}





....Did you mean actually to do this instead?:





for (i=0; i%26lt;cust_index+1; i++)


{


if (bank[i].ssn == SSN)


{


if (bank[i].act_type == 1)


{


c_index=i;


}


else


{


s_index = i;


}


}


}
Reply:why is this posted in this section!!!


No comments:

Post a Comment