fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Widget
  5. {
  6. public:
  7. float num;
  8.  
  9. float widget(int count)
  10. {
  11. num=(float)count/160;
  12. return num;
  13. }
  14.  
  15. };
  16.  
  17. int main() {
  18. // your code goes here
  19. int now;
  20. float nod;
  21. Widget w;
  22. cout<<"Enter the number of widgets";
  23. cin>>now;
  24. if(now<0)
  25. {
  26. cout<<endl<<"Invalid widget count";
  27. }
  28. else
  29. {
  30. nod=w.widget(now);
  31. cout<<endl<<"Number of days required to produce "<<now<<"widgets is: "<<nod<<" days";
  32. }
  33. return 0;
  34. }
  35.  
  36.  
Success #stdin #stdout 0s 3472KB
stdin
200
stdout
Enter the number of widgets
Number of days required to produce 200widgets is: 1.25 days