ndeniche 402 Posting Virtuoso Featured Poster

ok... look...

when you initialize a variable with no values, this variables has a random value stored in it. in your program, you assign values to your variables until the end, where you have your switch...

what you have to do is the following:

#include <iostream>
using namespace std;
int main(void)
{
    int a,b,c,d,radius,volumeprism;//see how you can declare
                                   //several variables at the
                                   //same time
    double volumesphere;//volumesphere must be declared as a
                        //double so it returns decimal values

    cout << "Welcome to the program!\n\n";
    cout << "Do you want the volume of:\n";
    cout << "1. Cube\n";
    cout << "2. Sphere\n";
    cout << "3. Exit\n";
    cin >> a;
    switch (a)
    {
    case 1:
        cout<<"enter length";
        cin >> b;
        cout<<"enter height";
        cin >> c;
        cout<<"enter width";
        cin >> d;
        volumeprism=b*c*d;//the math operation you had @ the
                          //beginning goes here so it multiplies
                          //the values you want it to multiply
        cout << volumeprism;
    break;

    case 2:
        cout << "enter radius";
        cin >> radius;
        volumesphere=1.333333333333*3.1415926536*(radius^3);

        //here's the other math operation you had up there

        cout << volumesphere;
    break;

    case 3:
        return 0;
    break;
    }
    
    return 0;
}

and that should do the trick...

the problem is you thought a mathematical operation done in a variable would be done every time you gave different values to variables...

well... that doesn't happen in c++ (or even any other languages)...

ndeniche 402 Posting Virtuoso Featured Poster

or an amazing imagination... :D

ndeniche 402 Posting Virtuoso Featured Poster

yup, you should give values to a,b, c and radius before using them in a mathematic operation...

int a;//you
int b;//are
int c;//not
int radius;//giving any values to these variables
int volumeprism;
volumeprism=a*b*c; //so when you use them here, 
//it will give you random numbers,
//or what we call junk

got it?

ndeniche 402 Posting Virtuoso Featured Poster

first of all, the first warning (the one that says about double and int) means that you are initializin an integer (whole number) with values of a double number (a number with decimal points and extreme accuracy)... so, you should initialize your variable as a float or double...

ndeniche 402 Posting Virtuoso Featured Poster

that's why they invented phones... to stop playing chess via mail... :P

ndeniche 402 Posting Virtuoso Featured Poster

have you heard i'm not okay from my chemical romance?

i agree with you serunson in: +44, Bryan Adams, Coldplay, The Darkness (though the only song i've ever heard is 'i beleive in a thing called love'), HIM, Led Zep, Nickleback, Red Hot Chili Peppers, U2...

i also like Oasis... they have cool songs to play in the guitar... wonderwall, don't look back in anger, lyla, stand by me...

but the greatest of them all is the greatest author there is... it's not like he has the best of voices, but his rhymes are amazing... his name is Ricardo Arjona, from Guatemala... ever heard of him?

ndeniche 402 Posting Virtuoso Featured Poster

most of the time, when you install vista you need to download drivers compatible with vista, since, as i said, they messed up sound drivers... maybe intentionally...

ndeniche 402 Posting Virtuoso Featured Poster

what if we want to play it un-interesting, slower and un-exciting through daniweb? :D

ndeniche 402 Posting Virtuoso Featured Poster

selfish... you don't own this thread, you know... haha... kidding... i'll play you quintoncoert... wanna be white?

ndeniche 402 Posting Virtuoso Featured Poster

i guess your mistake is not using break; after each case... if you don't do this, your switch will run all the way until all the cases are done...

another thing i would advise you to do is use the default until the end of the switch statement, since this way you will not have this kind of problems...

this i wrote it as a response to your first post, where the program executed all of the commands even ehen they were in a switch...

you are pretty close to what is posting correctly your code... all you have to do identify the code you are using as c code ([[B]code=c[/B]]), and write your code with the right margins so it is easier to follow...

second, what your teacher means by putting the package in a loop is that, for example, if the user inputs the wrong package once, he will be able to input a wrong package the second time, and get away with murder... this is why you must do a while loop that checks if the user's answer is inside the boundaries of the package...

i recommend you do the same thing with the hours...

by the way... there's no need to do this:

case 'a':
case 'A':...

you can do it this way:

case ('a'||'A'):...

i'm sure narue will correct me if i'm wrong...

this, i wrote it as a response to your second question, answering what your teacher meant when he said that your package needed to …

ndeniche 402 Posting Virtuoso Featured Poster

my chemical romance... these are other huys that i love to hear...

ndeniche 402 Posting Virtuoso Featured Poster

yup... mark (bass guitar) and travis (drums)...

and tom is now in angels and airwaves, as he continues with his side project "boxcar racer"... they have pretty cool songs, like 'i feel so', or 'there is' (meaning, boxcar racer)...

but as much as mark and travis are in +44 and tom is in angels and airwaves, their music will never be the same as blink's... they were just... too incredible... have you paid attention as the amazing way travis plays the drums?

ndeniche 402 Posting Virtuoso Featured Poster

i'm sorry... please don't stop talking to me... :P

it's just that i'm used to laugh like that... but i'll do my best... okay?

ndeniche 402 Posting Virtuoso Featured Poster

all of that (metallica, black sabbath, the red jumpsuit apparatus, dashboard confessional (i love vindicated)) is pretty great... but my favourite band is blink 182...

it still hurts when i think they broke up...

though i don't know which song is better: the classic of classics "All The Small Things" or the last single "Not Now"...

ndeniche 402 Posting Virtuoso Featured Poster
#include<iostream>
using namespace std;

int qsrt(int array[], int first, int last){ 
    int over = 0;
    over = first-last;
    int g=0;
    if(over==0){
        return 0;
    }int c=0;
    int start = first;
    int end = last;
    int pivot = array[first];
    int temp =0;
    while(first != last){
        while((array[last]>pivot)&&(first != last)){
            last--;
        }while((array[first]<pivot)&&(first != last)){
            first++;
        }temp = array[last];
        array[last] = array[first];
        array[first] = temp;
        c = last-first;
        if(c>1){
            first++;
            last--;
        }
    }c= 0;
    c= first-1;
    qsrt(array,first,end);
    qsrt(array,start,(c));
    return 0;
}

int main (void){
    int anarray[9] = {4,5,3,8,5,6,2,8,9};
    qsrt(anarray,0,8);
    system("pause");
    return 0;
}

first, you should learn how to format your code correctly...


second, saying this

int a=0;
a=b-c;

is the same thing as saying

int a=b-c;

when you have b and c declared...

third, what are you doing there? it seems like you are ordering numbers from least to greatest... but... JRM is right... you could do this with less variables...

ndeniche 402 Posting Virtuoso Featured Poster

alright... alright... jeje...

it had been a long time since i got you mad at me huh narue?

ndeniche 402 Posting Virtuoso Featured Poster

i can't remember how to get past level 10... i'm sooo mad...

ndeniche 402 Posting Virtuoso Featured Poster

may be... 'cause it loaded the first like... 6 or 7 posts, and then stopped responding...

it didn't happen in my pc... but in one @ my university...

ndeniche 402 Posting Virtuoso Featured Poster

what's SVN?

ndeniche 402 Posting Virtuoso Featured Poster

yup... thats because of the pronunciation of both letters (O.K.)... which at the end sounds the same as okay... but i heard that a long time ago, so i didn't know if it was correct... (meaning the Oll Korrekt thing...)

ndeniche 402 Posting Virtuoso Featured Poster

because it's not voodoo powf... you're really close... you are reading wrong the last character... (it's not ONE character... they're two)...

no, seriosuly, it's a differnet one.

oh yeah... i've seen that too... although i preferred notpron...

ndeniche 402 Posting Virtuoso Featured Poster

that's because it is in here www.notpron.com

ndeniche 402 Posting Virtuoso Featured Poster

yup...

ndeniche 402 Posting Virtuoso Featured Poster

i started playing when i was like 7 or so... i even bought a hand made chess set in rome, that represents a battle between romans and barbarians in metal pieces... pretty cool...

ndeniche 402 Posting Virtuoso Featured Poster

how true is that O.K. stands for Oll Korrekt (meaning all correct, used by germans in WWII)

ndeniche 402 Posting Virtuoso Featured Poster

you must read carefully the messages and hints that you are given... i bet they will come in handy...

ndeniche 402 Posting Virtuoso Featured Poster

sometimes the answer consists in looking at the page source... instead, there is a point where you MUST look at the page source of every new level to get past it...

for those who haven't played it, notpron is an amazing riddle game... for those who want to check it out (i don't know if this would qualify as spam) here it is... www.notpron.com

ndeniche 402 Posting Virtuoso Featured Poster

but, if you are evaluating a character, along with another one, say in this case is capital form, can't you do it with an or || expression?

case ('a'||'A')
ndeniche 402 Posting Virtuoso Featured Poster

though, castling can be dangerous, since you may cpture your king behind a row of pawns... so you have to know how to play it well...

ndeniche 402 Posting Virtuoso Featured Poster

why?

ndeniche 402 Posting Virtuoso Featured Poster

now it's my turn to try it on a scooter...

ndeniche 402 Posting Virtuoso Featured Poster

this is an awesome game!!!! my god... i fried my brains thinking in the anwers to these amazing riddles... i got until level 26... then got banned for cheating... haha

ndeniche 402 Posting Virtuoso Featured Poster

i've learned the best way to open the game is taking your middle pawns to the center along with your knights... then, according to your opponent, your game might follow in different ways...

it IS a bad idea to move both your rooks and your queen from the first line... i would recommend to move throughout the table one of your rooks and your bishops... always leave at least one rook protecting your king, alonng with the queen...

ndeniche 402 Posting Virtuoso Featured Poster

while i was trying to enter "everything and anything" in the geeks' lounge, my explorer crashed several times, so i gave up trying to enter this thread... is there any special reason for this to happen?

ndeniche 402 Posting Virtuoso Featured Poster

then why in the world everyone interpreted humpty dumpty was an egg? actually, ebing a cannon makes perfect sense... :P

ndeniche 402 Posting Virtuoso Featured Poster

You're wrong :icon_razz:
If you aren't sure, it only takes a minute or two to test ideas like this one before posting and prevents Narue from having fun at your expense :icon_twisted:

:-/ I like it when narue makes fun of me... i don't know... maybe i'm a little wacked... but it just adds a little sense of humor to my day...:D

ndeniche 402 Posting Virtuoso Featured Poster

but, it works with what lovetwins wants to do, since it will evaluate if package equals to 'a' or || 'A' ...

ndeniche 402 Posting Virtuoso Featured Poster

that's curious, because flash based hard drives should wear out after some time using it, just as jbennet said...

oh my god!!!! you've discovered the immortal usb drive!!! grant us with your mercy, oh! divine usb drive...

ndeniche 402 Posting Virtuoso Featured Poster

I dunno.. when you have to plan stuff out and go touring and stuff.. it's just boring. The only vacation I like is when I have a computer, I can relax, and I have nothing planned to do

why planning? there's nothing better than spontaneous vacations... getting up at 9:00 in the morning and say: "what am i gonna do today? what can i invest (meaning waste) my time on? hmmm... it's been a ong time since i don't go to (insert place or location here)..." you know what i mean? plans are for organized people... i like it being un-organized... when you don't know what will you do with your spare time... (even though it might come in handy sometimes to be organized...)

ndeniche 402 Posting Virtuoso Featured Poster

you are pretty close to what is posting correctly your code... all you have to do identify the code you are using as c code ([[B]code=c[/B]]), and write your code with the right margins so it is easier to follow...

second, what your teacher means by putting the package in a loop is that, for example, if the user inputs the wrong package once, he will be able to input a wrong package the second time, and get away with murder... this is why you must do a while loop that checks if the user's answer is inside the boundaries of the package...

i recommend you do the same thing with the hours...

by the way... there's no need to do this:

case 'a':
case 'A':...

you can do it this way:

case ('a'||'A'):...

i'm sure narue will correct me if i'm wrong...

ndeniche 402 Posting Virtuoso Featured Poster

but the best waters i've ever seen are the ones surrounding sorrento, Italy... All the way from the coast to the island, it's sooo nice...

I had a hard time voting i the poll... since i love traveling, but i also love going to water parks... and even more amusement parks... but i think i have better times in amusement parks...

ndeniche 402 Posting Virtuoso Featured Poster

i would recommend you the book i read, but... it's in spanish, so i think it would be of no use...

ndeniche 402 Posting Virtuoso Featured Poster

ja!!! i'm on fire!!!!

>>I'm sure you'll say something stupid
>>eventually and things will be back to normal

Thank you... i'm flattered

ndeniche 402 Posting Virtuoso Featured Poster

you must be in a really good mood today... i had never seen two consecutive agreements with me in anything...

ndeniche 402 Posting Virtuoso Featured Poster

ohh... i didn't think on that... hehe...

thnx for the advise...

ndeniche 402 Posting Virtuoso Featured Poster

>why don't you better use cin and cout?
Agreed. Perhaps this thread is in the wrong forum and he's really using C.

finally wee agree on something...

by the way... i'm not yet too familiar with using printf and scanf... since i've always worked with cin and cout... and i prefer using those because the other two are two tricky to use, and trigger lots and lots of problems...

ndeniche 402 Posting Virtuoso Featured Poster

by the way tformed... ever considered using code tags?

ndeniche 402 Posting Virtuoso Featured Poster

if i wouldn't have decided to study computer science... i would have been a chef!!!

or maybe i can be both...:P

i only hope dani has tried any of the dishes recommended here... 'cause if not, she's sooo missing it...

ndeniche 402 Posting Virtuoso Featured Poster

somewhere out there i read that microsoft screwed up all sund cards with vista, since vista only plays certain kinds of sound files...

though i solved my problem by downloading brand new vista-compatible drivers for my creative sound card from the site...
maybe if you search for vista-compatible drivers for your sound cards...

ndeniche 402 Posting Virtuoso Featured Poster

i actually run vista with 1 gig, and i'm expecting my pc to die someday soon... i think it was a bad idea installing vista on a computer this old... (about 2 years)... i've already reached its maximum capacity...

though somewhere out there i read that vista has a new feature in which you can use flash devices as auxiliary ram... how accurate is that?