Need help with Assignment - painter's activities

HELP - problems in programming

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

33 Replies - 1698 Views - Last Post: 08 June 2008 - 07:01 AM Rate Topic: -----

#31 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 08 June 2008 - 03:26 AM

hey KYA yea the job input is fine its the numbers thats the problem
Was This Post Helpful? 0
  • +
  • -

#32 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3101
  • View blog
  • Posts: 19,140
  • Joined: 14-September 07

Re: Need help with Assignment - painter's activities

Posted 08 June 2008 - 03:39 AM

use isDigit() then to check for numerical input
Was This Post Helpful? 0
  • +
  • -

#33 shadow_7  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 05-June 08

Re: Need help with Assignment - painter's activities

Posted 08 June 2008 - 03:48 AM

 cout << "Enter the minutes worked on this particular section: ";
		switch (jobInput){
			cin.clear();

i just tried to put it in here after the user inputs the minutes but its
"Error: allmost.cpp(30,21):Call to undefined function 'isDigit'"
so would a work
while (!cin.good())
{
cout << "Bad input, begin again.\n";
cin.seekg(0);
cin.clear();
cin >> "new value"" //etc
}


Was This Post Helpful? 0
  • +
  • -

#34 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon




Reputation: 1382
  • View blog
  • Posts: 10,962
  • Joined: 06-February 08

Re: Need help with Assignment - painter's activities

Posted 08 June 2008 - 07:01 AM

You need to #include <cctype> like so:
#include <iostream>
#include <cctype> // isdigit(int) header

int main ()
{
    int x;
    std::cin >> x;
    if (!isdigit(x))
        // do something
}

Hope this helps :)
Was This Post Helpful? 1
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3