Project 2 FAQ

Project 2 FAQ - Spring 2009 CS 31 Project 2 FAQ How do I...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Spring 2009 CS 31 Project 2 FAQ How do I return from main() other than by reaching the end of it? You can do something like this: Y int main() { do some stuff if ( something bad happened ) { write an error message return 1; // non-zero value means failure } do some more stuff } If something bad happens, this will write an error message and terminate the program without doing some more stuff. When I run my program, why does the dialog proceed like this? Initial meter reading: 3425 Final meter reading: 3468 Customer name: Month number (1=Jan, 2=Feb, etc.): 11 --- You must enter a customer name. Y or like this o Initial meter reading: 3425 Final meter reading: 3468 Customer name: --- You must enter a customer name. Y Why didn't it give me a chance to type the name of the customer? If you had read the Some Things about Strings writeup, you'd know why. (Look at the discussion of the Floral Tapestry example and the use of cin.ignore(…) .) Should the very last character my program writes be a newline?
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/07/2009 for the course CS 31 taught by Professor Melkanoff during the Spring '00 term at UCLA.

Page1 / 2

Project 2 FAQ - Spring 2009 CS 31 Project 2 FAQ How do I...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online