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

programming help needed

Name: Anonymous 2009-01-04 17:26

so here is the project

"write a program that asks the user for a series of integers one at a time. When the user enters the integer 0, the program displays the following info.:
-the number of integers in the series ( not including 0)
- average of the integers
-largest integer in the series
-smallest in the series
- difference between the largest and smallest."

heres what I got so far

"
#include<iostream.h>

main()
{
int number, average, largest, smallest, difference = 0;
int i;
do
{
cout << " enter a number";
cin >> i;
if (i == 0)
{
cout << "The number of integers in the series" << number << endl;
cout << "The average of the integers" << average << endl;
cout << "The largest integer in the series" << largest << endl;
cout << "The smallest integer in the series" << smallest << endl;
cout << "The difference between the largest and smallest integer in the series" << differece << endl;
{break;}
}
}
while (1);
system("pause");
return 0;
"

Name: Anonymous 2009-01-04 17:53

You missed a "}" at the end.

Name: Anonymous 2009-01-04 17:57

Also, you want more if statements. The largest can be sorted out by declaring largest and smallest to be 0, then adding

if(i>largest){largest=i;}

if(i<smallest){smallest=i;}

The declared integer "number" wants to start as 0 and increment by 1 each time the loop runs. "average" wants to start as 0 then have i added to it each time, and when i==0 you want it to be divided by "number".

etc...

Name: Anonymous 2009-01-04 18:43

#include <iostream>
#include "time.h"

void wait(int);

int main( )
{
    int count = 0, total = 0, min, max, i;
    float avg;

    cout << "Gimme sum numbers bitch." << endl;
    cin >> i;

    min = max = i;

    while (i != 0) {
        count++;
        total += i;
        min = (i < min ? i : min);
        max = (i > max ? i : max);

        cout << "MOAR! " << endl;
        cin >> i;
    }

    avg = (float)total / count;




    if (count == 0) {
        cout << "Shiiiiit.  Wat u trying to pull nigger? You din't type no numbers!" << endl << endl;
        wait(3);
        cout << "You din't type no numbers!" << endl << endl;
        wait(3);
        cout << "You better get the FUCK out of here right now before I fuckin cap yo' ass muthafukker." << endl << endl;
        system("pause");
        return 0;
    }

    cout << endl << endl;
    wait(3);
    cout << "Oh, so now you expect me to do all da maffs for you, huh?" << endl << endl;
    wait(3);
    cout << "Well fuk dat shit!" << endl << endl;
    wait(2);
    cout << "Do yer own fukkin addin 'n shit.  I gots hos to stick." << endl << endl;
    wait(3);
    cout << "I can't be wastin all muh time wit 'dis numbering 'n shit." << endl << endl;
    wait(3);
    cout << "Now get the hell outta muh face before I put a bullet in your ass." << endl << endl;
    wait(3);
    cout << "Fucking cracker." << endl << endl;

    system("pause");
    return 0;
}



void wait(int delay) {
    clock_t start;

    start = clock();
    while ((double)(clock() - start) < delay * 1000) ;
}

Name: Anonymous 2009-01-04 20:12

Wow, I'm surprised you had the wits to stay away from /prog/

Name: Anonymous 2009-01-04 23:18

what is this, bring your homework to 4chan day?

Name: Anonymous 2009-01-05 6:36

>>6
It is better than most /sci/ threads.

Name: Anonymous 2009-01-05 15:28

/sci/ is boring

Name: Anonymous 2009-01-05 19:03

>>8
no u

Name: Foxtrot 2013-03-10 6:46


FOXTROT


Computer : "I HAVE UNIX UNDERPINNINGS! I HAVE UNIX UNDERPINNINGS!"

Jason Fox : "BIG DEAL."

Jason Fox leave his seat and remove his pant.

Computer : "UNIX UNDER-PANTS??"

Jason Fox : ""CHMOD 700 *," BABY."


© 2002 Bill Amend /Distributed by Universe Press Syndicate


www.foxtrot.com

Name: Anonymous 2013-08-11 3:12

Why Do Some Programming Languages Live and Others Die? : http://gizmodo.com/5917296/why-do-some-programming-languages-live-and-others-die

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