trying to figure out how to work out
cin.ignore(100,'\n');

cin>>idnum;

  while(!cin.eof())
    {
      cin>>code;

      if(code == 'm'  || code == 'M')
        {
         

        }
      if(code == 'h' || code == 'H')
        {
          cin>>hours;

          if(hours<=forty)
            {
              
          }
           if (hours > forty)
            {
             
            }


        }
      if (code == 'C' || code=='c')
        {
          
            }

         if(daystotal > 1500.00)
        {
          
        }
        }
         if(code=='P' || code== 'p')
           {
             cin>>values1>>values;
             sum=0;
             while(values !=-1)
               {
  
               }

             

        }
         else

           {
             cin.ignore(100,'\n');
             error++;
             cout<<endl;
             cout<<error<<" errors were found"<<endl;
           }
      cin>>idnum;

}

it works but the last part in else doesnt it counts all my data this is my data
98787 h 44 8.98
7433 H 34 89.89
4938 m 384.44
3984 M 456.45
384 P 2.34 4 5 3 77 33 -1
879 p 3.44 4 5 3 2 43 -1
89789 m 849.33
123 A this is a bad data line
15 x 30.0 5 7
my output
ID# CATEGORY Earned
98787 Hourly $ 413.08

1 errors were found
7433 Hourly $ 3056.26

2 errors were found
4938 Manager $ 384.44

3 errors were found
3984 Manager $ 456.45

4 errors were found
384 Piecework $ 285.48
879 Piecework $ 196.08
89789 Manager $ 849.33

5 errors were found

by the way i erase some of the code so nobody will steal it thank you

Recommended Answers

All 5 Replies

cant tell your code doesnt seem to read the file properly maybe you should print the data to the screen after reading it that way you can actually follow what the code is reading it also helps to use punctuation so we dont have to struggle to understand your question i hope this answer helps you understand both problems

unless your planning on using this in a business there is really no reason you can't post full code.

from what i could comprehend your are trying to ignore the value 100? and then print a newline ?

if so

//replace value with what your are trying to compare unless its a string.
if(value==100){
cout<<'\n';
error++;
cout<<"An Error has occurred.\n";
}

if not please try to elaborate better if your not use to speaking english use google translations to translate your native language to english :P

unless your planning on using this in a business there is really no reason you can't post full code.

Sure there is.
1) It's too long
2) Cheating/lazy classmates.

if not please try to elaborate better if your not use to speaking english use google translations to translate your native language to english :P

Have you actually see those translations? They're horrid! :icon_eek: And use punctuation yourself, please.

Yeah I have a bad habit in typing in lower case with no punctation sorry Walt.
They are pretty bad but they do make it easier to read particularly in first year english students(no offense to anyone).

Ryamjones,
If you haven't discovered it yet, the code (as you posted it) has an extra right-brace at line 35 or 36. But that would cause a compile-time error.

As has been suggested in several other threads here, consider using getline() to read each line from your input into a string, then creating an istringstream from the string and reading your values from that. This will eliminate the need to clear cin.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.