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 Fuck2012-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;
//-------------------------------------------------
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;
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..
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.
>>6
I typed this shit with one finger. Put some effort into it.
Name:
Anonymous2012-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.