Exforsys

Online Training

URGENT: filling and array/functions/loops

This is a discussion on URGENT: filling and array/functions/loops within the C and C++ forums, part of the Programming Talk category; Heyy can some one please tell me how to do this ASAP? I will reallyyy appreciate it..Thank You!! =) Display ...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-26-2008, 05:47 PM
Junior Member
 
Join Date: Nov 2008
Posts: 1
Zahra11 is on a distinguished road
Post URGENT: filling and array/functions/loops

Heyy can some one please tell me how to do this ASAP?
I will reallyyy appreciate it..Thank You!! =)

Display the following:
1. Enter Data
2. Compute and Display Statistics
3. Quit the program

3) WHILE the user hasn't entered anything keep looping.
Once the user enters either a 1, 2 or a 3 drop into that particular section of code. Meaning you will have 4 IF statements, if the person enters 1, let them enter the data. If they enter 2, check that you already have some data in memory - if you dont ask the user to enter data. If they enter 3, quit the program. If they enter ANYTHING else that isn't 1 or 2 or 3 remind them what the valid options are.

3a) IF the user entered 1:
initialize your integer array to all zeroes. start getting data from the user one Integer at a time. you should also have some "control" character used to abort entry. I like to use "q"

that is: WHILE (we dont have more than 50 Integers in the array OR the user hasn't entered a "q") keep getting data from the user
at this point it would be a good idea to keep track of how many numbers were entered, for use in (3b)

3b) IF the user entered 2:
Do the required mathematical computations. remember the user CAN enter a 0. so keeping track of how many numbers the user ACTUALLY entered is useful, because your array initially contained 0's. imagine this... the user enters a 1, a 0 and a 5. if your program quit here just because it saw a 0 your data analysis would be incorrect. you should know 3 numbers were entered and do analysis on them.

3c) quit!

3d) stay in the while loop, but print a line to remind the user what the correct options are
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Anybody having TCS 9th july paper.....its urgent! luvureet Placement Papers 1 07-14-2005 04:00 AM
Anybody having TCS 9th july paper.....its urgent! luvureet Interview Questions 0 07-13-2005 06:13 AM
plz help ...its urgent luvureet Interview Questions 1 06-15-2005 09:42 AM
Urgent Requirement for Java/.NET Architects/Business Analysts/Telecom profession kalareddy Experienced Job Seekers - India 0 05-23-2005 07:41 PM
Urgent opening for Jr Developers for a leading IT company. techguru Freshers Jobs 0 05-23-2005 07:57 AM


All times are GMT -4. The time now is 04:42 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.