having a problem

This is a discussion on having a problem within the C++ Programming forums, part of the General Programming Boards category; here is my code Code: cout<<"Number of Runners for Marathon in group"; cin>>regs; while (runner > 0) { count++; if ...

  1. #1
    Registered User
    Join Date
    Mar 2010
    Location
    Toronto<3 can a duh
    Posts
    5

    having a problem

    here is my code

    Code:
     	cout<<"Number of Runners for Marathon in group";
    	cin>>regs;
    
    	while (runner > 0)
    	{
    		count++;
    
    	if (runner >=1)
    		fee= fee*count;
    		
    	if (runner >= 5)
    		fee= fee*count;
    		
    	
    	if (runner >=15)
    		fee= fee*count;
    		
    	
    	cout<<"Enter next group of runners";
    	cin>>runner;
    	}
    
    	totalRunner= count;
    	totalfee= chargeOne && chargeTwo && chargeThree;
    	average= totalCharge/regs;
    1. the program will allow as many groups to enter the runners that will participate
    2.after the runners entered is 0.i want the program to display the amount of runners , total fee amount, and the average for each runner

    here is the fee table

    runner fee
    1-5 runners= 20 each
    5-15 runners= 50 each
    15 runner or more= 70 each

  2. #2
    Registered User
    Join Date
    Mar 2010
    Location
    Toronto<3 can a duh
    Posts
    5
    Code:
    int main()
    {
    	//v
    	short runner = 0;
    	short count = 0;
    	double totalfee = 0.0;
    	double average = 0.0;
    
    	//i
    	cout<<"Number of Runners for Marathon in group";
    	cin>>runners;
    
    	while (runner > 0)
    	{
    		count++;
    
    	if (runner >=1)
    		fee= fee*count;
    		
    	if (runner >= 5)
    		fee= fee*count;
    		
    	
    	if (runner >=15)
    		fee= fee*count;
    		
    	
    	cout<<"Enter next group of runners";
    	cin>>runner;
    	}
    
    	totalRunner= count;
    	totalfee= chargeOne && chargeTwo && chargeThree;
    	average= totalCharge/runner;
    
    	//o
    	cout<<"Total Amount of Runners"<<count<<endl;
    	cout<<"Total Amount"<<totalfee<<endl;
    	cout<<"Average Per Runner"<<average<<endl;
    
    	return 0;
    }
    here is the whole code

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21