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 Thursday May 15, 2025, our attendants will be Vicky 🥰, Monica 🥰, Ada 🤩, Cici 😍 and Sophie 🤗. Call us at ☎️(905) 479-6668☎️ to book!
  2. wilson holistic centre:
    💕💕Beautiful Korean girl working at 382 Wilson Ave 💕💕☎️☎️416-840-0071❤️❤️
  3. SL East Spa:
    💆‍♀💖WooHoo Wed💖 Ultimate destination for Asian massages🎉 Two fab spots: Richmond Hill & Oakville✨ Your passport to paradise with 9 enchanting girls fr China, HK, Japan & Korea — 🆕Gigi, Cindy, Coco,Cici, Amber, JPN Yui, Akino, Jasmine & Lucy— 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🙌
  4. Lilyspa1:
    Lily Spa :💕💕Thursday Schedule 🇮🇳🇮🇳Sana 23, , Punjabi girl , very pretty 36 DDD 😈GFE ❤️Elena ( Latino ) Big Nature Boobs & SuSu ( Asian )Slim , 😍😍Porn Service 🔥Duo 🔥,☎️ 6475318288
  5. 89moonstar&MoonMoon:
    MoonMoon spa/4377554655 Persian girl Jasmine && Bradford location:6477129688 (Text only)
  6. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 Table Shower Sea Salt Bath Body Scrub😘 Japanese girl Nina ❤️ Natural Big Boobs 38 DD 😘Pink Mini Nipples Hot body slide, super enjoyable😘😘😘😘 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 appoint
  7. Nu spring spa888:
    🌹🌹🌹sexy hot Philippine 💖 💖 Canadian 💖 💖 Indian girls 👍working at Nu spring spa💋💋☎️416-669-8508🌹🌹🌹
  8. LittleMan:
    Best masage in Oakville/Burlington? Please recommend
  9. wonderspa:
    🌺Wonder spa,(9421Jane st unit127)call416-5000-800☎️best massage in vaughan,Wednesday RMT available,💄sexy face young girl Joey natural c cup,very good looking nice body slide,really popular 🍎long hair Q Lucy good strong to relax oil massage, Relieve pain and remove stress,more experience,🌹young friendly Cici slim body ,backwalk,amazing ending ,bring you comfortable warm time😀🔥🔥
  10. Spa in Markham:
  11. BlueXado Therapy & Spa:
  12. Pink Flower Spa:
  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. wilson holistic centre:
    💕💕Beautiful Korean girl working at 382 Wilson Ave 💕💕☎️☎️416-840-0071❤️❤️
  15. Soul Relax Spa:
    ✨ Looking for a relaxing escape? ✅ Click Here Meet🌸Tina🌸Jessica🌸IsabellaCall 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! ✨
  16. Lilyspa1:
    Lily Spa :💕💕 Wednesday Schedule 🇮🇳🇮🇳Kajal 23, Punjabi girl 😈GFE & bbbj ❤️❤️Elena ( Latino ) Big Nature Boobs & SuSu ( Asian )Slim , 😍😍Porn Service 🔥Duo 🔥,☎️ 6475318288
  17. 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: 🔥 Feifei😘Our new Japanese beauty Feifei specializes in creating an intimate and deeply relaxing massage experience tailored to your desires. Her soft, skilled hands glide effortlessly, easing tension and awakening your senses
  18. Golden Sunshine Spa:
    ✨Click on our Username and FOLLOW US for updates and special services ! ✅ Click Here Today🌸Akame🌸Fran🌸Xuka🌸Lynda Call us ☎ 905 - 265 - 2158☎️ Your ultimate service awaits! ✨
  19. bnwellness_wilson:
    We have 4 young girls are working today, young flirty Ivy 36DD with big buttocks 30’s and sexy Coco, pretty Ella 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
  20. ForeverWarden:
    Wednesday at 🫦❤️🔴🟥♾️𝓕𝓞𝓡𝓔𝓥𝓔𝓡 𝓢𝓟𝓐♾️🟥🔴❤️🫦2190 Warden Ave, Unit 201, Scarborough 𝟰𝟭𝟲-𝟴𝟬𝟬-𝟳𝟴𝟴𝟳: Bella, Cindy & Sasa. Bella is around 5’3” with a thin to medium build, C Cups, and a pleasing personality. She can offer dfk, bbbj and cfs as well as a good massage experience. 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
  21. HolidaySpa:
    Wednesday at 🌴😎🌅𝓗𝓸𝓵𝓲𝓭𝓪𝔂 𝓢𝓹𝓪🌅😎🌴3517 Kennedy Rd, Unit 4, Scarborough ☎️𝟰𝟯𝟳-𝟮𝟰𝟳-𝟭𝟭𝟵𝟵☎️: FIONA, KIKI & CINDY. FIONA is a slim hottie with long dark hair, great melons and ass, and nice services. Kiki is very attractive, young, about 5’4” and 110 Lbs., slim with a banging body. Kiki is very popular for her great attitude and services. CINDY is slim & incredibly sexy
  22. SugarLoveSpa:
    Wednesday at ❤️💙 💜⎝𝗦𝗨𝗚𝗔𝗥 𝗟𝗢𝗩𝗘 𝗦𝗣𝗔⎠💖💗💘: ELLA, NANCY, SUSAN & TIFFANY. 1270 Finch Ave W (at Keele St), Unit 18. North York, ON ☎ 𝟰𝟯𝟳-𝟯𝟲𝟱-𝟮𝟲𝟴𝟴 ☎ ELLA is a lovely Thai sweetheart, 5’1” with C Cups, smooth skin and a very pleasing attitude. NANCY is a curvy and very friendly Spanish girl, who has all the versatile skills you need. SUSAN is a small, slim & sexy Latina girl
  23. luckywellness:
    Lucky Wellness Center 4379721888 295 Eglinton Ave E,Unit 7,Mississauga We had two girls working today. Niko and Kiki. They are both young, pretty and cute. The massage and back walking were very good.
  24. Lulu_Villa_Spa:
    Sami is a gorgeous model type Vietnamese Girl Mia new Vietnamese girl Bella She is Mexican Gorgeous face Natalie she is CBC/filipina mixed Petite girl ☎️647- 446-0886
  25. Red Rose Spa:
    🌸 We have 5 hot brown girls today 🌸 PAOLA, SASHA, AMMU, JANVI, AMANDA, MIMI, PREETI, KIRAN, MONIKA, SALMA 🌸 2588 Birchmount 🌸 2 Invergordon 🌸 647-702-8800 🌸 Please visit for a great erotic massage
  26. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 Table Shower Sea Salt Bath Body Scrub😘 Japanese girl Nina ❤️ Natural Big Boobs 38 DD 😘Pink Mini Nipples Hot body slide, super enjoyable😘😘😘😘 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 appoint
  27. 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 Beautiful Girls : New Girl Apple, Young RMT Student Helen, Magical Mia and Work out🏋🚴💪 Babe Amy! SPECIAL PROMO 30 MINS 2 GIRLS $70 🌹🌹**TODAY'S PICK OF THE DAY IS 🍭🍬HELEN AND APPLE🍬🍭**
  28. EMSpa_schedule:
    Tomorrow's sneak peek: On Wednesday May 14, 2025, our attendants will be Carla ❤, Cici 🤗, Opal 🤗, Sandy 😘 and Yoyo 🥳. Call us at ☎️(905) 479-6668☎️ to book!
  29. SL East Spa:
    💆‍♀💖Tuesday 💜 Ultimate destination for Asian massages🎉 Two fab spots: SL Richmond Hill & SL West Oakville✨ Your passport to paradise with 9 enchanting girls fr China, HK, Japan & Korea — 🆕 Aliyah, Lucy, Yui, new Jojo, Coco, Cici, busty Amber, Kelly & 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🙌
  30. Lilyspa1:
    Lily Spa : 💰💰100 hh all in💰💰 ❤️❤️ 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
  31. Spa in Markham:
  32. BlueXado Therapy & Spa:
  33. Pink Flower Spa:
  34. 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
  35. 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: 🔥 Yumi😘💋A striking new tall gorgeous Korean model with long, flowing reddish-brown hair cascading down her back and a slender, elegant figure that exudes grace and poise. Yumi’s natural confidence and allure, make her approa
  36. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 New ❗️ New girl Anna dainty and cute! Sexy body Hot body slide, super enjoyable😘😘😘😘 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 back door with plenty of p
  37. wonderspa:
    🌺Wonder spa,(9421Jane st unit127)call416-5000-800☎️best massage in vaughan,Tuesday RMT available,💄sexy very young girl Mimi,natural c cup,very good looking amazing massage nice body slide,really popular 🍎long hair Lucy Q smile,very good strong to relax oil ,back walk,more experience 😻very popular girl,more experience,must try🔥🔥
  38. Golden Sunshine Spa:
    ✨Click on our Username and FOLLOW US for updates and special services ! ✅ Click Here Today🌸Akame🌸Christina🌸Xuka🌸Lynda🌸Isabella Call us ☎ 905 - 265 - 2158☎️ Your ultimate service awaits! ✨
  39. ForeverWarden:
    Tuesday at 🫦❤️🔴🟥♾️𝓕𝓞𝓡𝓔𝓥𝓔𝓡 𝓢𝓟𝓐♾️🟥🔴❤️🫦2190 Warden Ave, Unit 201, Scarborough 𝟰𝟭𝟲-𝟴𝟬𝟬-𝟳𝟴𝟴𝟳: Cindy, Tracy & Vivian. 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. Tracy is an incredibly cute & pretty Japanese/Taiwanese mixed spinner, about 5’1” and 100 lbs. She is very popular for her exotic massage & services.
  40. AliceSpa:
    TUESDAY at 𝗔𝗟𝗜𝗖𝗘 𝗦𝗣𝗔, 4915 Steeles Ave. E, Scarborough 𝟰𝟭𝟲-𝟮𝟵𝟴-𝟬𝟴𝟵𝟴. 3 Young Beauties Today at Alice Spa. Open 10am to 9pm: ASHLEY (12pm-9pm) is a beautiful slim Korean student, snow white skin, 5'2, 100 Lbs, natural C Cup, pink nipples, baby face & voice, can accomodate bbbj cim cof rim dfk, excellent services. CLOUDIA (11:30am-9pm): is Vietnamese, young, petite 5'2" & 96 Lbs
  41. wilson holistic centre:
    new girl works at 💋535 Evans Ave today 💕💕💕☎️☎️416-531-6969☎️☎️
  42. HolidaySpa:
    Tuesday at 🌴😎🌅𝓗𝓸𝓵𝓲𝓭𝓪𝔂 𝓢𝓹𝓪🌅😎🌴3517 Kennedy Rd, Unit 4, Scarborough ☎️𝟰𝟯𝟳-𝟮𝟰𝟳-𝟭𝟭𝟵𝟵☎️: EMMA, JENNY & CINDY. EMMA is a very beautiful slim Chinese honey with C Cups, beauty face, & nice services to drive you wild. Jenny has a medium build, nicely curvy with a slim waist, pretty face, and very flexible skills. Jenny will make you very happy. CINDY is slim
  43. SugarLoveSpa:
    Tuesday at ❤️💙 💜⎝𝗦𝗨𝗚𝗔𝗥 𝗟𝗢𝗩𝗘 𝗦𝗣𝗔⎠💖💗💘: CHRISTINA, MIMI, JENNY & TIFFANY. 1270 Finch Ave W (at Keele St), Unit 18. North York. CHRISTINA is Spanish, C Cups, 5'3", tall & nice curves, very open minded. MIMI is a slim & busty Asian/Euro mix beauty, 50Kgs & 1M60. Mimi has a very versatile range of services. JENNY is a sweet & young Korean girl with C Cups. Very versatile services.
  44. Soul Relax Spa:
    ✨ Looking for a relaxing escape? ✅ Click Here Meet🌸Nina🌸Anna🌸XukaCall 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! ✨
  45. bnwellness_wilson:
    We have 4 young girls are working today, young pretty Mia 25’s with curve body and young Taiwanese Victoria slime 25’s open mind, young sexy Sophia with curve body 30’s 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
  46. Red Rose Spa:
    🌸 We have 11 hot brown girls today 🌸 MONICA, ANGEL, SONIA, PRIYA, AMANDA, PAOLA, PREETI, KIRAN, ANGELINA, MONIKA, SALMA 🌸 2588 Birchmount 🌸 2 Invergordon 🌸 647-702-8800 🌸 Please visit for a great erotic massage
  47. luckywellness:
    Lucky Wellness Center 4379721888 295 Eglinton Ave E,Unit 7,Mississauga We have two girls working today. Kiki and Bella. They are both short, young, pretty, with lovely smiles and good massage.
  48. Lulu_Villa_Spa:
    Suki From Taiwan, sweet girl Cherry 🍒 From Malaysia Part time School girl Sami Vietnamese Girl Natalie she is CBC/filipina mixed Petite girl
☎️647- 446-0886
  49. Lulu1980:
    Phoenix Blossom Spa 🌹🌹🌹2 girls 🔥🔥🔥5124 Dundas St W Etobicoke☎️416-817-3366👍 New ❗️ New girl Anna dainty and cute! Sexy body Hot body slide, super enjoyable😘😘😘😘 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 back door with plenty of p
  50. DareDevil:
    Blackpink Wellness ♥️♥️90 Marycroft Ave. Unit #2, Vaughan, 🍭🍬ON L4L 5Y1 (647) 395-3188. BEAUTIFUL AND SEXY GIRLS TODAY: 🌹Superstar Bobo and Beautiful Tiffany on duty🌹.
Back
Top