Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Thousands Sepearator

Thousands Sepearator

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BRIMID
    wrote on last edited by
    #1

    This is tne final step in my program and I cannot figure it out. Where do I enter the line with the slashes next to them? I changed the number to amount in the program. In the posoiton they are in I get 19 errors.Below is what was given: string input; int number; int pos = input.find(','); while (pos != -1) { ////input.replace(pos, 1, ""); ////pos = input.find(','); } number = atoi(input.c_str()); cout << number<< endl; This is what I done. int main() { int c; float fee; double total; char a ='y', ans; ////string input; //// int amount; while(a =='y'|| a =='Y') { cout << "\nChoose from options below.\n"; cout << "\nEnter A to calculate total RWA cost.\n"; cout << "\nEnter B to calculate RWA base estimate.\n"; cout << "\n\t\tEnter your choice, then press the enter key:"; cin >> ans; cin.ignore(); if (ans == 'A' || ans == 'a' ){ cout << "\nEnter RWA Base Estimate, then press the enter key:$"; cin >> amount; ////int pos = input.find(','); ////while (pos != -1) ////{ ////input.replace(pos, 1, ""); ////pos = input.find(','); ////} ////amount = atoi(input.c_str()); ////cout << amount<< endl; cout << fixed; cout.precision(2); fee = amount * 0.04; cout << "4% Management Fee:$" << fee <<"\n"; total = amount + fee; cout << fixed; cout.precision(2); cout << "Total:$" << total <<"\n";

    P 1 Reply Last reply
    0
    • B BRIMID

      This is tne final step in my program and I cannot figure it out. Where do I enter the line with the slashes next to them? I changed the number to amount in the program. In the posoiton they are in I get 19 errors.Below is what was given: string input; int number; int pos = input.find(','); while (pos != -1) { ////input.replace(pos, 1, ""); ////pos = input.find(','); } number = atoi(input.c_str()); cout << number<< endl; This is what I done. int main() { int c; float fee; double total; char a ='y', ans; ////string input; //// int amount; while(a =='y'|| a =='Y') { cout << "\nChoose from options below.\n"; cout << "\nEnter A to calculate total RWA cost.\n"; cout << "\nEnter B to calculate RWA base estimate.\n"; cout << "\n\t\tEnter your choice, then press the enter key:"; cin >> ans; cin.ignore(); if (ans == 'A' || ans == 'a' ){ cout << "\nEnter RWA Base Estimate, then press the enter key:$"; cin >> amount; ////int pos = input.find(','); ////while (pos != -1) ////{ ////input.replace(pos, 1, ""); ////pos = input.find(','); ////} ////amount = atoi(input.c_str()); ////cout << amount<< endl; cout << fixed; cout.precision(2); fee = amount * 0.04; cout << "4% Management Fee:$" << fee <<"\n"; total = amount + fee; cout << fixed; cout.precision(2); cout << "Total:$" << total <<"\n";

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      You have everything in the correct place. Just change the line

      cin >> amount;

      to

      cin >> input;

      I ran the code as posted here (added missing closing braces) and it ran fine.


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups