Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Correcting C++ program
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
RichardVandebeek




PostPosted: Wed Oct 28, 2009 8:28 am   Post subject: 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.
Sponsor
Sponsor
Sponsor
sponsor
DemonWasp




PostPosted: Wed Oct 28, 2009 9:10 am   Post subject: 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




PostPosted: Wed Oct 28, 2009 11:08 am   Post subject: Re: Correcting C++ program

also...
RichardVandebeek @ Wed Oct 28, 2009 8:28 am wrote:
stdlib.h
printf( "Enter length " );
scanf( "%C", &yard );

You seem to be using C, not C++.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: