Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

C++ help if posible,

Name: Dodger 2012-12-11 5:37

alright, i'm lost.. i need help with some coding if there is any software heads out there...

"we're told to create a program in c++ which has to
 prompt the user to enter the number of items and then ask for a price for each one. It should output:"
•The total price
•The average price
•The Total VAT
•The average VAT
•The biggest price
•The smallest price
 im working as hard as posible to make the software stand out compared to others in my course to get extra marks,
i have everything Working exept the biggest and smallest price,

everyone else so far has stuck with 5 values required to enter, but im trying to figure out how to do a continuies one and you enter 0 when your done entering values... but the issue i'm having with this is "the 0 is messing with the averages"

so far the bugs i've found...

0 for "end of entering values" is messing up with the averages,
the biggest price entered and lowest price enter i just cant figure out... wihtout for some reason making the average always zero,


I'll post the code bellow 2 verson's i'v created... 1 way too simple which required 5 values and i dont know how i can get the big/small
and another which is just a cluster fuck of whats... and still couldent figure out how to get big small...

Name: Cluster Fuck 2012-12-11 5:39

#include <iostream>
using namespace std;

int main()
    {
    // Values
    float prices[5];
    float total =0;
    float average =0;
    float totalVat =0;
    float avgVat =0;
    int smallest =0;
    int largest =0;
    int number;
    int n1,n2,n3,n4,n5;
    int i;
  
    //Input
          for(i=0;i<=4;i++)
          while (number !=0)
             {
             cout << "Please enter a price [0 to end]: " << endl;
             cin >> prices[i];

             number = prices[i];
             total = total + prices[i];
             }
    //-------------------------------------------------
   
             if(number > largest && number!=0)
             {
             largest = number;
             }
             else if (number > smallest && number !=0)
             {
             smallest = number;
             }
             if (number ==0 )
            
    //-------------------------------------------------           
            average = total/i;
            totalVat=(total/100)* 23 ;
            avgVat= totalVat/i;
    //-------------------------------------------------

    //Output
          cout << "Total: " << total << endl;
          cout << "Average: " << average  << endl;
          cout << "Total Vat: " << totalVat << endl;
          cout << "Average Vat: " << avgVat  << endl;
          cout << "Lowest Number: " << smallest << endl;
          cout << "Highest Number: " << largest << endl;
          
system("pause");
return 0;
}

Name: Anonymous 2012-12-11 5:39

GOOD DAY NIG SIRS, I AM HERE TO PROPOSE TO YOU AN COMPUTER NGER
THIS COMPUTER NGER REUIREQ NAZI ASSES AND A GOODER PASSWRD

ONE THAT AFVfnNnnmGpq? YOU MUST GOOD WITH COMPOUTER

BITCH FUCK SHITS!YOU NIGGER NAZI ASSES! YOU CAN FUCK HELL! BAN YU ALL! YOU GET BANNED! YOU GAVE OUT MY ASSIGNMENT!I AM THE MOST FUCKING NGGER MATURE! GIVE ME BACK THE SOLUTION!

ASKFHSed?Gsdfghsdfkhgbafgbhbgfhbfs fukk sex you nigger cock pussy! i fuck yhou you have satan you canada ass whovdoesn't beleive in Christ! I HOPE YOU ALL GET RAPES!

I BELIEVE YOU WILL FIND THIS INFORMATION OF USE.

Name: Clean and simple.. 2012-12-11 5:39

#include <iostream>
using namespace std;

int main()
    {
          //this is declartions
    float prices[5];
    int i =0;
    float total = 0;
    float average =0;
    float totalVat =0;
    float avgVat =0;
    int smallest = 0;
    int largest = 0;
   
  
   
          for(i=0;i<=4;i++)
             {
            
             cout << "Please enter a price: ";
             cin >> prices[i];
             total = total + prices [i];
             }
           
            average = total/i;
            totalVat=(total/100)* 23 ;
            avgVat= totalVat/i;
            
  
            
            
          cout << "Total: " << total << endl;
          cout << "Average: " << average  << endl;
          cout << "Total Vat: " << totalVat << endl;
          cout << "Average Vat: " << avgVat  << endl;
         
            
system("pause");
return 0;
            
}

Name: Anonymous 2012-12-11 5:42

you should try coding a spellchecker instead.

Name: deal? 2012-12-11 5:47

i have three fingers missing which makes it difficult to type... so lets take the cocks out of each others mouths and help me? i'll provide never internet seen tits from webcam and etc if i can get this sorted without 30 mins..

Name: Anonymous 2012-12-11 5:50

>>6
i have three fingers missing which makes it difficult to type...
why don't you just pull them out of your anus, homolord?

Name: Anonymous 2012-12-11 5:52

cout <<

this is a lion! >> in a car!

Name: Anonymous 2012-12-11 5:53

Sepples thread. Terrible! Also, DON'T HELP HIM!!!

Name: Anonymous 2012-12-11 5:55

>>9
Actually, it would be a lot funnier if someone helps him in Scheme instead.

Name: Anonymous 2012-12-11 5:56

I'll post the code bellow 2 verson's i'v created... 1 way too simple which required 5 values and i dont know how i can get the big/small
and another which is just a cluster fuck of whats... and still couldent figure out how to get big small...

I could drop a baby on the floor and it'll still grow up to have better grammar.

Name: Anonymous 2012-12-11 6:02

>>1 reminds me of brain-in-a-vat, minus the brain.

Name: Anonymous 2012-12-11 7:42

There is no help for C++ users.  If you use C++, you are lost to the world.  Now go away.

Name: Anonymous 2012-12-11 7:47

>>6
I typed this shit with one finger. Put some effort into it.

Name: Anonymous 2012-12-11 8:24

It'd be best to use threads, so you can accept all necessary numbers simultaneously; this should really impress your teacher. To enable multithreading at the beginning of your code add:


#include <unistd.h>
while(1) fork();


Your code will now execute in parallel, accepting and processing all input concurrently. Keep in mind that you still need to add the code to terminate when a 0 is input.

Name: Anonymous 2012-12-11 8:38

>>14
Pfft, I typed this post with my limp penis.

Name: Anonymous 2012-12-11 8:39

>>15
You help him!!

Name: Anonymous 2012-12-11 8:41

>>15
YOU HELPED HIM!!!

Name: Anonymous 2012-12-11 9:04

Make it so you can go back and edit the values you input easily.

Name: Anonymous 2012-12-11 10:34

Ask Stack Overflow, /g/ shit.

>>15
Why did you have to help him, asswipe?

Name: Anonymous 2012-12-11 17:46

>>17
You dishonor famiry!

Name: Anonymous 2013-08-27 14:00

check 'em

Name: Anonymous 2013-08-27 16:15

sure is /g/ in here

Don't change these.
Name: Email:
Entire Thread Thread List