Results 1 to 10 of 10

Thread: I need help wth thz programm so bad plz help :(

  1. #1
    Assad_786 is offline Junior Member
    Last Online
    27th February 2010 @ 10:22 AM
    Join Date
    07 Mar 2009
    Posts
    26
    Threads
    11
    Credits
    0
    Thanked
    0

    Unhappy I need help wth thz programm so bad plz help :(

    A salam / hello to all

    hope everyone is dng ok......

    Thz is my hw n i really need help wth it if smeone can helo me i will really appriciate....

    The prb is:

    Write a program that declares three single-dimensional arrays named price, quantity, and amount. Each array should be declared in main() and should be capable of holding ten double-precision numbers. The numbers that should be stored in price are 10.62, 14.89, 13.21, 16.55, 18.62, 18.62, 9.47, 6.58, 18.32, 12.15, 3.98. The numbers that should be stored in quantity are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, 4.8. Your program should pass these three arrays to a function called extend(), which should calculate the elements in the amount array as the product of the corresponding elements in the price and quantity arrays (amount[1] = price[1] * quantity[1], for example). After extend() has put values into the amount array, the values in the array should be display from within main().


    IF ANYONE KNW HOW TO DO THZ PLZ LET ME KNW...

    THNKZZZZ IN ADVANCE..............

  2. #2
    SufyanGujar is offline Senior Member+
    Last Online
    29th December 2010 @ 10:59 PM
    Join Date
    10 Oct 2009
    Location
    England, UK
    Age
    34
    Posts
    157
    Threads
    10
    Credits
    0
    Thanked
    7

    Default

    Quote Assad_786 said: View Post
    A salam / hello to all

    hope everyone is dng ok......

    Thz is my hw n i really need help wth it if smeone can helo me i will really appriciate....

    The prb is:

    Write a program that declares three single-dimensional arrays named price, quantity, and amount. Each array should be declared in main() and should be capable of holding ten double-precision numbers. The numbers that should be stored in price are 10.62, 14.89, 13.21, 16.55, 18.62, 18.62, 9.47, 6.58, 18.32, 12.15, 3.98. The numbers that should be stored in quantity are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, 4.8. Your program should pass these three arrays to a function called extend(), which should calculate the elements in the amount array as the product of the corresponding elements in the price and quantity arrays (amount[1] = price[1] * quantity[1], for example). After extend() has put values into the amount array, the values in the array should be display from within main().


    IF ANYONE KNW HOW TO DO THZ PLZ LET ME KNW...

    THNKZZZZ IN ADVANCE..............
    i dont understand it completely but as much as i do,
    i will try to explain and give code example,
    if you still dont get it then i will do this for you
    on weekend or before if i have time,
    (i got Driving test and some other assignments
    to finish so dont mind if i dont do it soon)

    basically you got to declare 3 double type arrays
    that holds 10 elements, in the main() function, like this;

    Code:
    double price[10];
    double quantity[10];
    double amount[10];
    then asssign those values given in assignment to first two arrays;
    then create a function named extend(double[], double[], double[]);
    that takes three arguments as shown above, ther are diferent ways tho.
    and pass these three arrays to dat function, either by value or refrence.
    realy depends on you the best way you understand; (either using pointers
    or references).

    then in dat extend() function do calculations, as shown in ur
    assignment "amount[1] = price[1] * quantity[1]" and so fourth.
    after assigning resuts of calculations to third array, go back to main()
    and call dat function to print 3rd array to screen (in other words cout
    the values of amount array),

    i think dats prety much done; and i have explained everything,
    if u need further help you can ask for it, and i will answer as soon
    as i read it, but as i told you i am prety bussy this week...

    -Saif

  3. #3
    SufyanGujar is offline Senior Member+
    Last Online
    29th December 2010 @ 10:59 PM
    Join Date
    10 Oct 2009
    Location
    England, UK
    Age
    34
    Posts
    157
    Threads
    10
    Credits
    0
    Thanked
    7

    Default

    i waz wondering which course you doing and where;
    i have seen your other assignments in this section
    and i think i also answered to one of your assignment
    a while ago, can you please provide details.
    Shukriya
    -Saif

  4. #4
    Assad_786 is offline Junior Member
    Last Online
    27th February 2010 @ 10:22 AM
    Join Date
    07 Mar 2009
    Posts
    26
    Threads
    11
    Credits
    0
    Thanked
    0

    Default

    Thnkzzz u so much for ur help Sufyan.....

    And yh u did help me wth one of my program b4 whch i also appreciate ur help....

    Yh itz ok take ur tym...im tryng to do it by my self also n i got to the part where i hve to open a file n all the...

    Im takng thz course in Rutgures in NJ,...n itz a C++ class as u knw...

    once again i really appreciate ur help....

    oh n also itz has to be a SORT function.....

    hope to hear frm u soon

  5. #5
    SufyanGujar is offline Senior Member+
    Last Online
    29th December 2010 @ 10:59 PM
    Join Date
    10 Oct 2009
    Location
    England, UK
    Age
    34
    Posts
    157
    Threads
    10
    Credits
    0
    Thanked
    7

    Default

    Quote Assad_786 said: View Post
    Thnkzzz u so much for ur help Sufyan.....

    And yh u did help me wth one of my program b4 whch i also appreciate ur help....

    Yh itz ok take ur tym...im tryng to do it by my self also n i got to the part where i hve to open a file n all the...

    Im takng thz course in Rutgures in NJ,...n itz a C++ class as u knw...

    once again i really appreciate ur help....

    oh n also itz has to be a SORT function.....

    hope to hear frm u soon
    oh ok, kuz give me some time maybe untill this weekend;
    i have passed my driving test; that waz today and this is
    awesome; i waz out with friends and now i only got 2 assignments
    to finish; but if you want to know more about dat assignment;
    go read chapter 9; of "Sams Teach Yourself C++ in 21 days";
    its on pointers; it explains in detail how to pass values to functions
    using pointers or read chapter on "functions" i think its chapter 6;
    There is somethn dat can make me more happy than i already am;
    can you see dat small button in right hand corner? well yea its "THNX"
    buton, press it....LOL!

    Thnx

  6. #6
    SufyanGujar is offline Senior Member+
    Last Online
    29th December 2010 @ 10:59 PM
    Join Date
    10 Oct 2009
    Location
    England, UK
    Age
    34
    Posts
    157
    Threads
    10
    Credits
    0
    Thanked
    7

    Default

    I do apologise if its too late but i waz realy busy
    whole weekend, just came back from cinema waz
    gona sleep and remembered your assignment, anyway;
    Here you go:

    Code:
    #include <iostream>
    
    using namespace std;
    
    void extend(double *price, double *quantity, double *amount);
    
    int main()
    {
    	double price[10] = {10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, 3.98}; 
    	double quantity[10] = {4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, 4.8}; 
    	double amount[10];
    
    	extend(price, quantity, amount);
    
    	cout << "Amount [0] = " << amount[0] << endl << "Amount [1] = " << amount[1] << endl;
    
    
    
    	system ("PAUSE");
    	return 0;
    
    }
    
    void extend(double *price, double *quantity, double *amount)
    {
    
    	amount[0] = price[0] * quantity[0];
    	amount[1] = price[1] * quantity[1];
    	amount[2] = price[2] * quantity[2];
    	amount[3] = price[3] * quantity[3];
    	amount[4] = price[4] * quantity[4];
    	amount[5] = price[5] * quantity[5];
    	amount[6] = price[6] * quantity[6];
    	amount[7] = price[7] * quantity[7];
    	amount[8] = price[8] * quantity[8];
    	amount[9] = price[9] * quantity[9];
    }
    Thats prety much it, just change whatever you want;
    just add apropriate cout statements and you are done;

    Good Luck with your course;

    -Saif

  7. #7
    DAWN is offline Senior Member+
    Last Online
    21st October 2014 @ 12:31 PM
    Join Date
    11 Jul 2008
    Location
    Faisalabad
    Age
    35
    Gender
    Male
    Posts
    2,002
    Threads
    86
    Credits
    0
    Thanked
    80

    Default

    o thanks sir you are great..........

  8. #8
    Assad_786 is offline Junior Member
    Last Online
    27th February 2010 @ 10:22 AM
    Join Date
    07 Mar 2009
    Posts
    26
    Threads
    11
    Credits
    0
    Thanked
    0

    Default

    first of all congrazzz for passing the examzz....n sry 4 replyng late i had sme othr class project whch i was so buzie wth so thtz y i couldnt reply u......btw thnxxxx alot bro...itz really help me n u save me 30 pointzz....i would to click on tht thxxxx button itz jst i cnt c it..i only c these buttons: Reply With Quote, Multi-Quote This Message, Quick reply to this message....

    if i would hve cn the thxx button i would hve press it without u askng....
    once again thxxx alot..
    n hope u hve a gud tym since u got licenses nw

  9. #9
    SufyanGujar is offline Senior Member+
    Last Online
    29th December 2010 @ 10:59 PM
    Join Date
    10 Oct 2009
    Location
    England, UK
    Age
    34
    Posts
    157
    Threads
    10
    Credits
    0
    Thanked
    7

    Default

    Quote DAWN said: View Post
    o thanks sir you are great..........

    Quote Assad_786 said: View Post
    first of all congrazzz for passing the examzz....n sry 4 replyng late i had sme othr class project whch i was so buzie wth so thtz y i couldnt reply u......btw thnxxxx alot bro...itz really help me n u save me 30 pointzz....i would to click on tht thxxxx button itz jst i cnt c it..i only c these buttons: Reply With Quote, Multi-Quote This Message, Quick reply to this message....

    if i would hve cn the thxx button i would hve press it without u askng....
    once again thxxx alot..
    n hope u hve a gud tym since u got licenses nw
    both of you thnx for reply, btw DAWN are you doing same course?
    and yea i had great time since i passed dat driving, i am still drivin dad's car
    without insurance but i am gona get 1 soon

  10. #10
    Sheeda_Pastol's Avatar
    Sheeda_Pastol is offline Senior Member+
    Last Online
    28th November 2010 @ 11:46 AM
    Join Date
    21 Dec 2005
    Location
    IRIS ga mo im nika ?
    Posts
    16,800
    Threads
    125
    Credits
    990
    Thanked
    344

    Default

    Moved from courses section

Similar Threads

  1. Mujhe c per ek programm chaye (its urgent)
    By Rizvann in forum Ask an Expert
    Replies: 1
    Last Post: 26th June 2011, 01:15 PM
  2. A Small but Nice Programm ... mY 2nd sharing
    By atif623 in forum Software Reviews
    Replies: 15
    Last Post: 25th February 2011, 06:12 PM
  3. A Great Programm (99 Names Of ALLAH...)
    By H.B.K in forum General Discussion
    Replies: 20
    Last Post: 25th December 2010, 01:16 PM
  4. DINNER PROGRAMM IN ITD 4th ANNIVERSARY.
    By Shehzad Iqbal in forum ITDunya 18th Anniversary (8 Nov 2023)
    Replies: 43
    Last Post: 11th November 2009, 10:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •