EASY EASY BEGINNER ?? 
Author Message
 EASY EASY BEGINNER ??

I am a beginning programmer, and I am stumped...

I need to write a program that scans in a person's ID number, and their
expense account total. The information will be put into an array.

The input is supposed to stop when the user enters 0 for the id nymber and
0 for the expense account total.

How do I fill this array using a loop that terminates when (0 0) is
entered for my data?

I do not check back often, so please email me.

Please make it as simple as possible!!!



Thu, 13 Sep 2001 03:00:00 GMT  
 EASY EASY BEGINNER ??
<< I do not check back often, so please email me.

Please make it as simple as possible!!! >>

Okay. Come back when you understand how newsgroups work. Have your simple
code ready.
--

Paul Lutus
www.arachnoid.com

<snip>



Thu, 13 Sep 2001 03:00:00 GMT  
 EASY EASY BEGINNER ??
Anthony C Brown schrieb:

Quote:

> I need to write a program that scans in a person's ID number, and their
> expense account total. The information will be put into an array.

> The input is supposed to stop when the user enters 0 for the id nymber and
> 0 for the expense account total.

> How do I fill this array using a loop that terminates when (0 0) is
> entered for my data?

> I do not check back often, so please email me.

Hi Anthony C Brown,

We typically do not provide homework solutions. That would be against the
concept of homework. And we usually do not provide e-mail answers as this
is against the concept of newsgroups. But what I can give you is a simple
example that might get you started:

 #include <stdio.h>

 int main( void )
 {
   int valuesRead;
   int val1, val2;

   do
   {
     valuesRead = scanf( "%d%d", &val1, &val2 );
     if ( valuesOk == 2 )
     {
       if ( val1 == 0 && val2 == 0 )
         break;

       /* Do whatever you want with your two values HERE. */
     }
     else
       printf( "ERROR: junk has been entered\n" );
   } while ( valuesRead == 2 );

  /* This point is reached if the user enters junk or if */
  /* "0 0" is entered.                                   */

   return 0;
 }

Stephan
(initiator of the campaign against grumpiness in c.l.c)
(-: A brandnew excellent FAQ version has been released !!! :-)
(-: Get it: http://www.eskimo.com/~scs/C-faq/versions.html :-)



Fri, 14 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. @> two easy easy questions

2. Beginner's COM question (easy)

3. Very easy beginners question

4. Beginner: CFile, a really easy(?) question

5. Beginner's COM question (easy)

6. EASY Beginner question

7. Is there an easy (easier) way to pass mathmatical formulas?

8. This is a biztalk question but probably an easy question for you C# guru's

9. should be easy, don't want new instance

10. easy : splash form

11. Namespaces seem easy - but what about this?

 

 
Powered by phpBB® Forum Software