C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 22nd, 2006, 12:09 PM
da don da don is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 da don User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 42 sec
Reputation Power: 0
Please can someone help me with this it's needs to b coded in c

[/* CH9A02.cpp */
/* Calculates average sales */
#include <stdio.h>
#include <conio.h>
void main ()
{
/* Description ......
Open input file
Display headings
Initialise grand total
FOR each person
Initialise person total
FOR each sales figure
Read sales
Accumulate person total and grand total
Calculate and display person average
Calculate and display overall average
Close input file
*/

/* const and variable declarations */

const int num_of_sales_people = 5,
num_of_sales_figs = 6 ;

int person_num,
sales_num ;
float sales_figure,
person_total,
person_average,
grand_total,
overall_average ;
FILE *inpfile = fopen ("figures.txt", "r") ;




getch () ;
} ]

this programme should read the text file figures.txt which contains the following info :

40 60 70 70 60 60
30 32 23 34 48 52
59 45 43 95 52 61
55 71 73 42 75 69
20 32 76 56 56 81

the output shud be displayed on screen as follows :

SALES FIGURES :

person average
1 60.00
2 36.50
3 59.17
4 64.17
5 53.50

overall average is 54.67

Reply With Quote
  #2  
Old January 22nd, 2006, 12:40 PM
Icon's Avatar
Icon Icon is offline
Command Line Warrior
Click here for more information. Click here for more information
 
Join Date: Sep 2005
Posts: 740 Icon User rank is Private First Class (20 - 50 Reputation Level)Icon User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 3 Days 12 h 33 m 16 sec
Reputation Power: 4
Nice, so what is the problem we can help you with? You already have a program yourself offcourse and you need help with some bug right?

Reply With Quote
  #3  
Old January 22nd, 2006, 01:00 PM
da don da don is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 da don User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 42 sec
Reputation Power: 0
Help

Ye i need help any ideas. Thanks

Reply With Quote
  #4  
Old January 22nd, 2006, 01:04 PM
da don da don is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 da don User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 42 sec
Reputation Power: 0
Hi

Do you want me to post what i have done so far and see if you can carry on from there

Reply With Quote
  #5  
Old January 22nd, 2006, 01:06 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Yes that would be good.
__________________
---Official Member Of The Itsacon Fan Club---
Give a man a fish and he will eat for a day. Teach a man to fish and he will sit in a boat all day drinking beer.

Reply With Quote
  #6  
Old January 22nd, 2006, 01:20 PM
da don da don is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 da don User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 42 sec
Reputation Power: 0
Here's what ive done so far any ideas


[/* CH9A02.cpp */
/* Calculates average sales */
#include <stdio.h>
#include <conio.h>
void main ()
{
/* Description ......
Open input file
Display headings
Initialise grand total
FOR each person
Initialise person total
FOR each sales figure
Read sales
Accumulate person total and grand total
Calculate and display person average
Calculate and display overall average
Close input file
*/

/* const and variable declarations */

const int num_of_sales_people = 5,
num_of_sales_figs = 6 ;

int person_num,
sales_num ;
float sales_figure,
person_total,
person_average,
grand_total,
overall_average ;
FILE *inpfile = fopen ("CH9A02.txt", "r") ;

printf ("SALES FIGURES\n") ;

Reply With Quote
  #7  
Old January 22nd, 2006, 01:32 PM
da don da don is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 da don User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 42 sec
Reputation Power: 0
[/* CH9A02.cpp */
/* Calculates average sales */
#include <stdio.h>
#include <conio.h>
void main ()
{
/* Description ......
Open input file
Display headings
Initialise grand total
FOR each person
Initialise person total
FOR each sales figure
Read sales
Accumulate person total and grand total
Calculate and display person average
Calculate and display overall average
Close input file
*/

/* const and variable declarations */

const int num_of_sales_people = 5,
num_of_sales_figs = 6 ;

int person_num,
sales_num ;
float sales_figure,
person_total,
person_average,
grand_total,
overall_average ;
FILE *inpfile = fopen ("CH9A02.txt", "r") ;

printf ("SALES FIGURES\n") ;
for (person_num = 1 ; person_num <= 5 ; ++ person_num)
{
fscanf (inpfile, "%d" , &person_average) ;
printf ("%2d", person_num) ;

That's what ive done so far any idea's

Reply With Quote
  #8  
Old January 22nd, 2006, 04:05 PM
da don da don is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 da don User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 42 sec
Reputation Power: 0
Talking Some one please help me with this program

Please can sumone help me with this programme, i will be very greatfull Thanks

Reply With Quote
  #9  
Old January 23rd, 2006, 06:04 AM
Neuro Neuro is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 Neuro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 47 sec
Reputation Power: 0
I'm not sure people will be happy to help you when you've tried so little!

Just take each string and work out how to extract each number. The rest should be trivial.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Please can someone help me with this it's needs to b coded in c


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT