
-----------------------------------
RichardVandebeek
Wed Oct 28, 2009 8:28 am

Correcting C++ program
-----------------------------------
Hi i am new to C++ programming and i need help correcting all the problems i have in the following program.

/*
 *  This  program reads a length in yards from
 *  the keyboard, converts the length  to feet
 *  and inches, and writes the converted length to
 *  the display.  It  is assumed that the length is
 *  a nonnegative integer.  
 *

#include {stdlib.h}
#include {stdio.h}

int main()
     printf( "Enter length " );
     scanf( "%C", &yard );


          foot = 3 * yrd;
          inch = 36 * yrd;

          printf( "\n%d yd =\n", &yrd );
          printf( "%d ft\n", &foot );
          printf( "%d in\n", &inch );
               

     printf( "*** END OF PROGRAM ***" );

     return ( 0 );

Any help would be much appreciated.

-----------------------------------
DemonWasp
Wed Oct 28, 2009 9:10 am

RE:Correcting C++ program
-----------------------------------
This looks like a homework assignment to me, given how riddled that code is with obvious errors. If that's actually your code, the least you can do is try compiling it (probably after closing that comment at the top) and reporting the errors so we don't have to compile it ourselves.

-----------------------------------
Tony
Wed Oct 28, 2009 11:08 am

Re: Correcting C++ program
-----------------------------------
also...
stdlib.h
printf( "Enter length " );
scanf( "%C", &yard );

You seem to be using C, not C++.
