Click here to Skip to main content
16,005,178 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Regular Expression Library for C++ Pin
Vivek Rajan25-Apr-03 19:17
Vivek Rajan25-Apr-03 19:17 
GeneralRe: Regular Expression Library for C++ Pin
User 665826-Apr-03 6:03
User 665826-Apr-03 6:03 
GeneralUrgent: OnKeyDown not getting executed - In Active X Control Pin
allcodeluver25-Apr-03 8:13
allcodeluver25-Apr-03 8:13 
GeneralRe: Urgent: onkeydown not getting executed - In Active X Control Pin
allcodeluver25-Apr-03 8:29
allcodeluver25-Apr-03 8:29 
GeneralPassing Structure Variables to Function Pin
webblynx25-Apr-03 7:49
webblynx25-Apr-03 7:49 
GeneralRe: Passing Structure Variables to Function Pin
David Crow25-Apr-03 8:06
David Crow25-Apr-03 8:06 
GeneralRe: Passing Structure Variables to Function Pin
webblynx25-Apr-03 8:22
webblynx25-Apr-03 8:22 
GeneralRe: Passing Structure Variables to Function Pin
David Crow25-Apr-03 8:49
David Crow25-Apr-03 8:49 
Here's one possible solution:

struct deposit <br />
{<br />
    char acnumber[10];<br />
    double rate;<br />
    double principal;<br />
    int years;<br />
    double amount; <br />
};<br />
<br />
double compute( deposit *pDeposit ) <br />
{<br />
    pDeposit->amount = (pDeposit->rate / 100.0) * pDeposit->principal * (double) pDeposit->years;<br />
<br />
    return pDeposit->amount;<br />
}<br />
<br />
void main() <br />
{<br />
    deposit d[n];<br />
<br />
    cout << "Please enter the account information." << endl;<br />
<br />
    for (int i = 0;i < n; i++)<br />
    {<br />
        cout << "Enter the 9 digit account number: ";<br />
        cin >> d[i].acnumber;<br />
<br />
        cout << "Enter number of years: ";<br />
        cin >> d[i].years;<br />
        <br />
        cout << "Enter the rate: ";<br />
        cin >> d[i].rate;<br />
        <br />
        cout << "Enter the principal amount: ";<br />
        cin >> d[i].principal;<br />
<br />
        cout<<"The amount is: " << compute(d) << endl;<br />
    }<br />
}


Here's another:

struct deposit <br />
{<br />
    char acnumber[10];<br />
    double rate;<br />
    double principal;<br />
    int years;<br />
    double amount; <br />
};<br />
<br />
void compute( deposit *pDeposit ) <br />
{<br />
    for (int i = 0;i < n; i++)<br />
        pDeposit[i].amount = (pDeposit[i].rate / 100.0) * pDeposit[i].principal * (double) pDeposit[i].years;<br />
}<br />
<br />
void main() <br />
{<br />
    deposit d[n];<br />
<br />
    cout << "Please enter the account information." << endl;<br />
<br />
    for (int i = 0;i < n; i++)<br />
    {<br />
        cout << "Enter the 9 digit account number: ";<br />
        cin >> d[i].acnumber;<br />
<br />
        cout << "Enter number of years: ";<br />
        cin >> d[i].years;<br />
        <br />
        cout << "Enter the rate: ";<br />
        cin >> d[i].rate;<br />
        <br />
        cout << "Enter the principal amount: ";<br />
        cin >> d[i].principal;<br />
    }<br />
<br />
    compute(d);<br />
}


The [code][/code] tags kill the indentation. Sorry!
GeneralRe: Passing Structure Variables to Function Pin
webblynx25-Apr-03 8:57
webblynx25-Apr-03 8:57 
Generalgethostbyaddr() Pin
Swinefeaster25-Apr-03 7:42
Swinefeaster25-Apr-03 7:42 
GeneralRe: gethostbyaddr() Pin
David Crow25-Apr-03 7:45
David Crow25-Apr-03 7:45 
GeneralRe: gethostbyaddr() Pin
Swinefeaster25-Apr-03 7:55
Swinefeaster25-Apr-03 7:55 
GeneralRe: gethostbyaddr() Pin
David Crow25-Apr-03 8:11
David Crow25-Apr-03 8:11 
GeneralRe: gethostbyaddr() Pin
Swinefeaster25-Apr-03 8:25
Swinefeaster25-Apr-03 8:25 
GeneralRe: gethostbyaddr() Pin
David Crow25-Apr-03 9:09
David Crow25-Apr-03 9:09 
GeneralRe: gethostbyaddr() Pin
Swinefeaster25-Apr-03 10:06
Swinefeaster25-Apr-03 10:06 
GeneralRe: gethostbyaddr() Pin
RobJones25-Apr-03 8:11
RobJones25-Apr-03 8:11 
GeneralRe: gethostbyaddr() Pin
Brian Shifrin25-Apr-03 8:23
Brian Shifrin25-Apr-03 8:23 
GeneralRe: gethostbyaddr() Pin
Swinefeaster25-Apr-03 8:27
Swinefeaster25-Apr-03 8:27 
GeneralRe: gethostbyaddr() Pin
Brian Shifrin28-Apr-03 15:44
Brian Shifrin28-Apr-03 15:44 
Generalproblem with null (uninitialized) objects Pin
Berkut25-Apr-03 7:40
Berkut25-Apr-03 7:40 
GeneralRe: problem with null (uninitialized) objects Pin
Berkut25-Apr-03 7:41
Berkut25-Apr-03 7:41 
GeneralRe: problem with null (uninitialized) objects Pin
David Crow25-Apr-03 7:51
David Crow25-Apr-03 7:51 
Generalfor DavidCrow Pin
Toni7825-Apr-03 8:20
Toni7825-Apr-03 8:20 
GeneralRe: for DavidCrow Pin
David Crow25-Apr-03 8:33
David Crow25-Apr-03 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.