Guest User

Untitled

a guest
Feb 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. double getSales(string line)
  2. {
  3. string num;
  4. double sales;
  5.  
  6. for(int index=0; index<=35; index++)
  7. {
  8. if(isdigit(line[index]) || (char)line[index]=='.') num+=(char)line[index];
  9. }
  10.  
  11. sales=atof(num);
  12. return sales;
  13. }
  14.  
  15.  
  16. error:
  17. SWICompanySales.cpp: In function `double getSales(std::string)':
  18. SWICompanySales.cpp:120: error: cannot convert `std::string' to `const char*' for argument `1' to `double atof(const char*)'
  19. rhune[hw9]$ c++ SWICompanySales.cpp -o SWISCompany
  20. SWICompanySales.cpp: In function `double getSales(std::string)':
  21. SWICompanySales.cpp:121: error: cannot convert `std::string' to `const char*' for argument `1' to `double atof(const char*)'
Add Comment
Please, Sign In to add comment