Need some code help... Newbie so make it easy + some code please :)?

Sikenflossy

Member
Joined
Sep 20, 2009
Messages
66
Reaction score
0
Points
6
What I want to do is have 10 dValue numbers, but if, of those 10 I only enter 5 values, the exe shouldnt ask me to enter all 10 and just add the 5 values I entered when I press the return key .. or something like that


//
// Add 3 numbers

//

#include <cstdio>

#include <cstdlib>

#include <iostream>

using namespace std;



int main(int nNumberofArgs, char* pszArgs[])

{

double dValue1;

double dValue2;

double dValue3;



// enter three numbers

cout << "This program adds three numbers;\n";



cout << "Enter three integers:\n";



cout << "n1 - ";

cin >> dValue1;


cout << "n2 - ";

cin >> dValue2;
cout << "n3 - ";
cin >> dValue3;

// the sum
cout << "n1 + n2 + n3 = ";

cout << dValue1 + dValue2 + dValue3;
cout << "\n";

// wait until user is ready before terminating program
// to allow the user to see the program results

system("PAUSE");
return 0;
 
you need a way for the user to communicate to the program that they are done entering values; by providing the user some sort of command you can accomplish this. (pressing the enter key would not be a good example of such a command seeing as how the enter key must be pressed to enter all other values)
 
Okay, first of all, if you want the user to only give integers, and no decimal numbers, than you should say int dValue# not double dValue#. Also, for cin, if you just press enter, it won't count as an input, it needs to actually have an input to count, so using the method that is in your description, there wouldn't be a way to only insert 5 out of 10 values. You could always ask the user how many integers they wish to add, then use that to determine how many of the dValues to cin for. That piece of code could look something like this:

int dValueAmount;

cout << "How many integers are you going to add?" << endl;

cin >> dValueAmount1;

if(dValueAmount>0){
cout << "n1 -";
cin >> dValue1;
dValueAmount--;
}

and then repeat the if statement 10 times, replacing the 1 characters with the correct numbers. But then you may want to add an else statement after each if statement telling the exe file to set the variable to 0 if dValueAmount is equal or less than 0. That would be like this:

if(dValueAmount>0){
cout << "n1 -";
cin >> dValue1;
dValueAmount--;
}
else
dValue1=0;

Then since the rest of the coding method you have above is fine, you'd just do the rest the exact same more or less. And since you set all extra dValues to 0, you can just act as if the user submitted all 10 values and just add all 10 together and print that out.
 
Shoutbox
  1. EMSpa_schedule:
    Tomorrow's sneak peek: On Saturday May 10, 2025, our attendants will be Vicky 🥳, Ivy 🥰, Lucy 💜, Opal 😍 and Sophie. Call us at ☎️(905) 479-6668☎️ to book!
  2. srayment:
    Shangri La
  3. wilson holistic centre:
    💕💕Beautiful Korean girl working at 382 Wilson Ave 💕💕☎️☎️416-840-0071❤️❤️
  4. Lilyspa1:
    Lily Spa : ❤️❤️ SuSu ( Asian )Slim , 😍😍Porn Service 🩷🩷Elena 22, Latino French, 36 DDD and 🍑🍑ASS, 💋💋Vicky 22, Philippine mixed White , very open-Minded , 😈bbbj , DFk 🔥Duo 🔥,☎️ 6475318288
  5. SugarLoveSpa:
    Sugar Love Spa . today have 💋❤️‍🔥👙ella, tiffany, ana, chrishtina 💋❤️‍🔥👙come to enjoy and all service available... Sugar Love spa☎️☎️ (437) 365-2688📲☎️ 💋💋❤️‍🔥❤️‍🔥❤️‍🔥👙👙👙
  6. 89moonstar&MoonMoon:
    MoonMoon spa/416 887 8801/8131Yonge st #203 Spanish Latin &22ys Colombia girl today &&& Bradford location:Moonstar Spa 6477129688 / 89 Holland st E Bradford west Gwillimbury 2 hot young girls today
  7. Soul Relax Spa:
    ✨ Looking for a relaxing escape? ✅ Click Here Meet🌸Kim🌸Isabella🌸MandyCall us today for the best treatment and service experience. Click on our Username and FOLLOW US for updates ! Call now ☎ 289 - 298 - 5662☎️ Your ultimate relaxation awaits! ✨
  8. SL East Spa:
    💆‍♀💖HAPPY Friday!!!💖 Ultimate destination for Asian massages🎉 Two fab spots: SL Richmond Hill & SL West Oakville ✨ Your passport to paradise with 10 enchanting girls fr China, HK, Japan & Korea — 🆕36D Flora, Cindy, Cici, Eva, Coco, JPN Yui, Happy, Cindy, Jasmine & Aaliyah — pamper yourself🎁🍁 Ring us 📞647-695-6354 or text us 📱647-578-8169✨ 160 East Beaver Cr., Unit 12, RichmondHill 💰Where Eastern charm meets Western comfort - your bliss
  9. Nu spring spa888:
    💖💖💖sexy hot busty Malaysian 🌹Germany 🌹Indian 🌹korean girls🌹🌹working 💗💗at markham ☎️416-669-8508❤️❤️❤️
  10. DareDevil:
    272 ARIA WELLNESS ♥️♥️ADDRESS: 360 HWY 7, UNIT #6, RICHMOND HILL♥️♥️,647-222-5683 (PHONES CALL ONLY, NO TEXT'N AVAILABLE) ♥️TODAY'S Schedule!♥️ Loaded lineup with Young Beautiful Girls : Ellagant Ella, Magical Mia and Work out🏋🚴💪 Babe Amy! BUY 10 HOURS (GET 11 HOURS) **TODAY'S PICK OF THE DAY ARE🍬🍬 Ella🍬🍭
  11. Golden Sunshine Spa:
    ✨Click on our Username and FOLLOW US for updates and special services ! ✅ Click Here Today🌸Cindy🌸Jessica🌸Chelsea🌸Selina🌸Nina Call us ☎ 905 - 265 - 2158☎️ Your ultimate service awaits! ✨
  12. wilson holistic centre:
    💕💕Beautiful Korean girl working at 382 Wilson Ave 💕💕☎️☎️416-840-0071❤️❤️
  13. Jenny’s Spa:
    🎉🍒JENNY’S SPA🎉🍒 ✅5170 DUNDAS STREET WEST✅ 👌ETOBICOKE ONTARIO M9A 1C4👌 ☎️( 647-893-5196)☎️Call or Text ☎️( 437-888-3759)☎️Call Only (ETOBICOKE) OPEN 10am to 9pm MONDAY to SUNDAY 🔥✅GRAND OPENING💯NEW GIRLS EVERYDAY🔥EXCELLENT MASSAGE + SERVICE QUEENS NOW AVAILABLE AT JENNY’S SPA FOR ALL YOUR MASSAGE AND SPECIAL EXTRA NEEDS🔥💯😘🔥❤️👌 🔥TWO BEAUTIFUL NEW YOUNG ASIAN GIRLS EVERYDAY🔥 💯REAL PICTURES OF ATTENDANTS💯 🔥💋Limited Time Special Promotion🔥💋 ✅💦30 Minutes Nude Mass
  14. Spa in Markham:
  15. Moneylee:
    All season wellness center : New Young girl big breasted beautiful buttocks charming temperament big boobs Mia,young girl pretty face nice figure Thai deep massage Aad,Young girl big breasted beautiful buttocks charming temperament big boobs Yoyo,Young girl Big breasted saucy naughty Ella ,Enchanting sexy petite deep massage Sherry 🏠address: #5-30 Rambler dr Brampton ,Ontario L6W 1E2☎️4376655510 🦵🦵👄👄🈵🈵👅👅
  16. Moneylee:
    Full season wellness center: New Young girl big breasted beautiful buttocks charming temperament big boobs Ivy , Young girl pretty face big boobs nice figure deep massage Jessica ,Young girl Big-breasted big Big boobs big butts Linda , Young beautiful face sexy body and good deep massage Maggie,Enchanting sexy petite deep massage Mary . 🏠 2560 Shepard Ave Mississauga unit 1 ☎️ 4379857899 🦵🦵👅👅🈵🈵👄👄
  17. BlueXado Therapy & Spa:
  18. Pink Flower Spa:
  19. wonderspa:
    🌺welcome to wonder spa☎️416-5000-800,L6a4H8,open10 to10,Ensuit shower available 🍅beautiful young Jessica deep tissue to relax massage back walk,hot stone🍅long hair vietname Amy is very good looking,slim body ,nice body slide sweet sensual touch 🌹beautiful sexy face ,big boob Joey ,amazing massage, starting to ending,really popular girl,must try🌹🌹👍
  20. bnwellness_wilson:
    We have 4 young girls are working today, young sweet Taiwanese Victoria 25’s slime open mind and young flirty Tina with sexy body open mind 30’s,young pretty Lily 25’s with curve body and Cute GFE Lina are providing deep tissue massage, pls call 4163985777 book appointment and walk in always welcome,back entrance and parking available, 350 Wilson Ave North York
  21. ForeverWarden:
    Friday at 🫦❤️🔴🟥♾️𝓕𝓞𝓡𝓔𝓥𝓔𝓡 𝓢𝓟𝓐♾️🟥🔴❤️🫦 2190 Warden Ave, Unit 201, Scarborough 𝟰𝟭𝟲-𝟴𝟬𝟬-𝟳𝟴𝟴𝟳 : Bobo, Mimi & Sasa. Bobo is a small, slim and sexy lady, petite with all natural busty melons for your enjoyment. Mimi is a nice slim lady with a big bottom, & great oral skills to take you to paradise. Sasa is a slim & sweet Korean lady, about 5’4” with C Cups.
  22. Annie Spa:
    🎉🍒ANNIE SPA🎉🍒 ✅7-1001 SANDHURST CIRCLE✅ 👌SCARBOROUGH ON M1V 1Z6👌 ☎️ (647) 891-9688☎️ ☎️ (416) 291-8879☎️ (FINCH & MCCOWAN) OPEN 9:30am to 9pm MONDAY to SUNDAY 🔥✅NEW MANAGEMENT💯NEW GIRLS🔥🔥 🔥GORGEOUS NEW YOUNG ASIAN GIRLS - TODAY’s ROSTER INCLUDES: 🔥 Ivy🔥🥰A stunning new Korean massage girl with a captivating presence, long silky brown hair cascading down her back, and a petite, elegant figure that exudes charm. Her warm touch and intuitive skills promise a deeply relaxing
  23. HolidaySpa:
    Friday at 🌴😎🌅𝓗𝓸𝓵𝓲𝓭𝓪𝔂 𝓢𝓹𝓪🌅😎🌴3517 Kennedy Rd, Unit 4, Scarborough ☎️𝟰𝟯𝟳-𝟮𝟰𝟳-𝟭𝟭𝟵𝟵☎️: FIONA, LINA & CINDY. FIONA is a slim hottie with long dark hair, great melons and ass, and nice services. LINA is very well known for her great services and her impressive shapely ass. Come and see why! You will be glad you did. CINDY is a slim & incredibly sexy lady with
  24. AliceSpa:
    FRIDAY at 𝗔𝗟𝗜𝗖𝗘 𝗦𝗣𝗔, 4915 Steeles Ave. E, Scarborough 𝟰𝟭𝟲-𝟮𝟵𝟴-𝟬𝟴𝟵𝟴. 3 ladies waiting for you. Two Very Hot ladies (Qiqi & Summer) have returned to Alice spa today. Open 10am to 9pm: JOJO: is a busty JAPANESE girl, nice DD Cup boobs, short, petite small body, pretty face AV S2tar, bbbj cim cof rim, special services available. LUCKY (11:30am-9pm): is Vietnamese, small body, busty D
  25. Lilyspa1:
    Lily Spa : ❤️❤️ SuSu ( Asian )Slim , 😍😍Porn Service 🩷🩷Elena 22, Latino French, 36 DDD and 🍑🍑ASS, 💋💋Vicky 22, Philippine mixed White , very open-Minded , 😈bbbj , DFk 🔥Duo 🔥,☎️ 6475318288
  26. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹3 girls 😘Table shower 、body scrub 、 Sea salt bath👍5124 Dundas St W Etobicoke☎️416-817-3366👍 Young girl Cherry (Student)😘😘“charming breasts.”beautiful curvy hips.”very provocative service😘😘😘, professional super Luna deep tissue massage, has therapeutic effect to loosen bones and relieve muscle pressure and will bring you unexpected service effects, she will bring you a little surprise😍😍😍😍❤️ You are welcome to make an appointment at any time or walk in the
  27. Lulu_Villa_Spa:
    Jessica Pretty Girl with amazing personality and super easy to get along with. Sasa friendly Vietnamese Judy is a gorgeous model type Vietnamese Girl Sami Vietnamese Girl Cherry 🍒 From Malaysia Part time School girl ☎️647- 446-0886
  28. DareDevil:
    Blackpink Wellness ♥️♥️90 Marycroft Ave. Unit #2, Vaughan, 🍭🍬ON L4L 5Y1 (647) 395-3188. BEAUTIFUL AND SEXY GIRLS TODAY: 🌹Superstar Julie, Sexy Akino and Beautiful Tiffany on duty🌹.
  29. DareDevil:
    ARIA WELLNESS ♥️♥️ADDRESS: 360 HWY 7, UNIT #6, RICHMOND HILL♥️♥️,647-222-5683 (PHONES CALL ONLY, NO TEXT'N AVAILABLE) ♥️TODAY'S Schedule!♥️ Loaded lineup with Young Beautiful Girls : Ellagant Ella, Magical Mia and Work out🏋🚴💪 Babe Amy! BUY 10 HOURS (GET 11 HOURS) **TODAY'S PICK OF THE DAY ARE🍬🍬 Ella🍬🍭
  30. EMSpa_schedule:
    Tomorrow's sneak peek: On Friday May 9, 2025, our attendants will be Vicky 😍, Ada 🤗, Carla ❤, Cici 🥰 and Opal 😍. Call us at ☎️(905) 479-6668☎️ to book!
  31. wilson holistic centre:
    new girl works at 💋535 Evans Ave today 💕💕💕☎️☎️416-531-6969☎️☎️
  32. Lilyspa1:
    Lily Spa : ❤️❤️ SuSu ( Asian )Slim , 😍😍Porn Service 🩷🩷Elena 22, Latino French, 36 DDD and 🍑🍑ASS, 💋💋Vicky 22, Philippine mixed White , very open-Minded , 😈bbbj , DFk 🔥Duo 🔥,☎️ 6475318288
  33. EMSpa_schedule:
    Hey! Where have you been? Today (Thursday), our amazing attendants are Ada 🤗, Cici 😘, Vicky 🥳, Sophie 😍 and Monica 😘. Call us at ☎️ (905) 479-6668 ☎️ to book your favourite and head on over to 7665 Kennedy Road, Unit 4, Markham!
  34. SL East Spa:
    💆‍♀💖Terrific Thursday 💖 Ultimate destination for Asian massages🎉 Two fab spots: SL Richmond Hill & SL West Oakville ✨ Your passport to paradise with 10 enchanting girls fr China, HK — 🆕Tiffany, Joey, Julie, Aaliyah, Cici, Coco, Yui, Meghan, Julia & New 34D Jasmine—— ready to pamper you🎁🍁 Ring us 📞647-695-6354 or text us 📱647-578-8169✨ 160 East Beaver Cr., Unit 12, RichmondHill 💰Where Eastern charm meets Western comfort - your bliss awaits
  35. Nu spring spa888:
    💖💖💖sexy hot busty 🌹 Indian 🌹🌹korean girls🌹🌹working 💗💗at markham ☎️416-669-8508❤️❤️❤️
  36. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹 Table shower body scrub Sea Salt Bath👍every day 3 girls 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 Nice girl Mia ❤️ Natural Big Boobs 36 DD 😘Pink Mini Nipples Hot body slide, super enjoyable😘😘😘😘 very provocative service😘😘😘, professional super Luna deep tissue massage, back walking has therapeutic effect to loosen bones and relieve muscle pressure and will bring you unexpected service effects, she will b
  37. Jenny’s Spa:
    🎉🍒JENNY’S SPA🎉🍒 ✅5170 DUNDAS STREET WEST✅ 👌ETOBICOKE ONTARIO M9A 1C4👌 ☎️( 647-893-5196)☎️Call or Text ☎️( 437-888-3759)☎️Call Only (ETOBICOKE) OPEN 10am to 9pm MONDAY to SUNDAY 🔥✅GRAND OPENING💯NEW GIRLS EVERYDAY🔥EXCELLENT MASSAGE + SERVICE QUEENS NOW AVAILABLE AT JENNY’S SPA FOR ALL YOUR MASSAGE AND SPECIAL EXTRA NEEDS🔥💯😘🔥❤️👌 🔥TWO BEAUTIFUL NEW YOUNG ASIAN GIRLS EVERYDAY🔥 💯REAL PICTURES OF ATTENDANTS💯 🔥💋Limited Time Special Promotion🔥💋 ✅💦30 Minutes Nude Mass
  38. wonderspa:
    🌺welcome to wonder spa☎️416-5000-800,L6a4H8,open10 to10.on Thursday ,Ensuit shower available 🍅beautiful Jessica come back,deep tissue to relax massage and nice body slide🍅sunny very good looking,big breasted sweet sensual touch really popular 🌹long hair young beautiful Lucy,friendly smile,back walk,strong to relax oil amazing ending,relief your stress,must try👍😍
  39. Lilyspa1:
    Lily Spa : ❤️❤️ SuSu ( Asian )Slim , 😍😍Porn Service 🩷🩷Elena 22, Latino French, 36 DDD and 🍑🍑ASS, 💋💋Yuki 24, Korean Slim , 😈bbbj , DFk 🔥Duo 🔥,☎️ 6475318288
  40. wilson holistic centre:
    new girl works at 💋535 Evans Ave today 💕💕💕☎️☎️416-531-6969☎️☎️
  41. AliceSpa:
    THURSDAY at 𝗔𝗟𝗜𝗖𝗘 𝗦𝗣𝗔.4915 Steeles Ave. E, Scarborough 𝟰𝟭𝟲-𝟮𝟵𝟴-𝟬𝟴𝟵𝟴. 3 girls here today at ALICE SPA. Open 10am to 9pm: JOJO (12pm-9pm): is a busty JAPANESE girl, magnificent DD Cup boobs, short, petite small body, pretty face AV Star, bbbj cim cof rim, special services available. KITTY (12pm-9pm) is a new Korean girl, super busty, small body, new to the business. Very friendly
  42. Annie Spa:
    🎉🍒ANNIE SPA🎉🍒 ✅7-1001 SANDHURST CIRCLE✅ 👌SCARBOROUGH ON M1V 1Z6👌 ☎️ (647) 891-9688☎️ ☎️ (416) 291-8879☎️ (FINCH & MCCOWAN) OPEN 9:30am to 9pm MONDAY to SUNDAY 🔥✅NEW MANAGEMENT💯NEW GIRLS🔥🔥 🔥GORGEOUS NEW YOUNG ASIAN GIRLS - TODAY’s ROSTER INCLUDES: 🔥 Suki😍is beautiful short petite tiny sexy student from Cambodia. Exotic features and model looks, Suki has a nice bum, slim waist, flat stomach and very good massage skills and has a great playful personality. Suki has a beaut
  43. ForeverWarden:
    Thursday at 🫦❤️🔴🟥♾️𝓕𝓞𝓡𝓔𝓥𝓔𝓡 𝓢𝓟𝓐♾️🟥🔴❤️🫦🫦2190 Warden Ave, Unit 201, Scarborough 𝟰𝟭𝟲-𝟴𝟬𝟬-𝟳𝟴𝟴𝟳: Cindy, Sophia & Tracy. Cindy is a slim beauty, 5’4”, natural C Cups. Her massage is nice, her services will drive you wild & her finish is a dream come true. Sophia is a sweet & pretty Chinese lady with natural B Cups and an awe-inspiring smooth rounded ass. Sophia can provide top notch services
  44. Moneylee:
    All season wellness center: Young girl big boobs beautiful face deep massage Midi,Young girl big boobs beautiful face deep massage Tina ,Young girl big breasted beautiful buttocks charming temperament big boobs Cindy ,Student big boobs buttocks Vicky, Enchanting sexy petite deep massage Sherry ,🏠address: #5-30 Rambler dr Brampton ,Ontario L6W 1E2☎️4376655510 🦵🦵👄👄🈵🈵👅👅
  45. Moneylee:
    Full season wellness center: young girl pretty face nice figure Thai deep massage Vivian , pretty face nice figure Thai deep massage Yuki ,Young girl big breasted beautiful buttocks charming temperament big boobs Anjoo ,Young girl Big breasted saucy naughty Ella,Enchanting sexy petite deep massage Mary. 2560 Shepard ave Mississauga unit 1 .☎️4379857899🦵🦵🈵🈵👅👅👄👄
  46. HolidaySpa:
    Thursday at 🌴😎🌅𝓗𝓸𝓵𝓲𝓭𝓪𝔂 𝓢𝓹𝓪🌅😎🌴3517 Kennedy Rd, Unit 4, Scarborough ☎️𝟰𝟯𝟳-𝟮𝟰𝟳-𝟭𝟭𝟵𝟵☎️: ANGELA, LUCY & CINDY. Angela is versatile and responsive. LUCY is a beautiful and slim Asian lady with a happy disposition and great services. CINDY is a slim & incredibly sexy lady with a smile that will melt your heart, & an ass that will fire up your spirit.
  47. SugarLoveSpa:
    Thursday at ❤️💙 💜⎝𝗦𝗨𝗚𝗔𝗥 𝗟𝗢𝗩𝗘 𝗦𝗣𝗔⎠💖💗💘: CHRISTINA, MIA, SARA & TIFFANY. 1270 Finch Ave W (at Keele St), Unit 18. North York, ON ☎ 𝟰𝟯𝟳-𝟯𝟲𝟱-𝟮𝟲𝟴𝟴 ☎ CHRISTINA is Spanish, C Cups, 5'3", tall & nice curves, very open minded. MIA is a young & slim 𝙎𝙋𝙄𝙉𝙉𝙀𝙍, very PRETTY & PETITE Vietnamese beauty with perfect natural A Cups, 5’1” & 90 Lbs, very versatile. Come and enjoy.
  48. bnwellness_wilson:
    We have 4 young girls are working today, young sweet Taiwanese Victoria slime open mind and young flirty Tina with sexy body open mind, sexy Coco and Cute GFE Ella are providing deep tissue massage, pls call 4163985777 book appointment and walk in always welcome,back entrance and parking available, 350 Wilson Ave North York
  49. Soul Relax Spa:
    ✨ Looking for a relaxing escape? ✅ Click Here Meet🌸Luna🌸Valentina🌸KellyCall us today for the best treatment and service experience. Click on our Username and FOLLOW US for updates ! Call now ☎ 289 - 298 - 5662☎️ Your ultimate relaxation awaits! ✨
  50. Spa in Markham:
Back
Top