MedVision ad

Has anyone started on COMP115 Assigment 1? I need help! (4 Viewers)

TheDreamer

New Member
Joined
Mar 10, 2004
Messages
20
So, Orange Juice, you've almost finished? I still get the same ouput to everything I input. Can you help me?

About the marking scheme, I think they only want the dimensions-46 586 and output-P4
 

Rahul

Dead Member
Joined
Dec 14, 2002
Messages
3,647
Location
shadowy shadows
Originally posted by TheDreamer
Uh sorry pb, don't know how to help you there hehe

Anyways, I get the same output as Orange Juice!! It's very frustrating isn't it? Well, might as well put down an example here so you guys can actually see what I'm missing.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <iostream.h>
#include <stdlib.h>


int main()
{

int month,December,August,September;

cout<<"Enter the month of your birthdate"<<endl;
cin>>December>>August>>September>>month;
if(month=December)
cout<<"If you were born in December,it is Summer "<<endl;
else if(month=August)
cout<<"If you were born in August,it is Winter." <<endl;
else if (month=September)
cout<<"If you were born in September, it is Spring."<<endl;


system("PAUSE");
return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

In this case, I keep getting" If you were born in December,it is Summer" .

You can copy the above eg. and test it out yourself.

NOTE: Just realised the computer doesn't even like me. The code on this posted message is DIFFERENT to my original. If any of you guys can help me, please give me your email address, and I'll send it to you there. It shouldn't mess up then. Thanks heaps.
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string> //header for strings

int main()
{

string month; //cannot use type int [integer] when dealing with characters

cout<<"Enter the month of your birthdate"<<endl;
cin>>month; //cannot command in 4 variables without outputting anything. 
                       //it also didnt make any sense to use a variable for december, sept, etc. you only need one variable 'month' to compare.
if(month == "December")  //when testing whether something is equal to something else use == instead of just =, which is used to designate a value.
cout<<"If you were born in December,it is Summer  "<<endl;
else if(month =="August")
cout<<"If you were born in August,it is Winter." <<endl;
else if (month =="September")
cout<<"If you were born in September, it is Spring."<<endl;
 

      system("PAUSE");
      return 0;
}
firstly, for such stages it is best to use an option in the question.
like...
what month were you born in?
a) January
b) August
c) September

people can make mistakes easily by guessing or by spelling.

also you should have a test for if none of your correct options are matched, it shows a "sorry, please try again statement." to code that, you need to learn a bit more. [linking modules, what you might not have done.]
 

Orange Juice

so worthless i am
Joined
Nov 23, 2002
Messages
3,886
Location
Room 112
Gender
Male
HSC
2007
greggy i think youve got the first one... teach us all!!!


dreamer... pm me your problem... im only a newbie at this so theres no guarantees i can help at all
 

TheDreamer

New Member
Joined
Mar 10, 2004
Messages
20
Orange J. Guess what!! I'm pathetic at C ++. So you can't be worse than me. lol

To Mick_et, don't think it matters. But if you're writing a code, it seems a bit loooonnnnggg.... If you're commenting, probably best to fit in it, so the markers don't have to scroll right.
That grey line, by the way, just the edge of printing A4.
 

pb

Inside The Hollow
Joined
Jan 20, 2004
Messages
775
Location
Westie!
Gender
Female
HSC
2003
i did it! i did it!!! I've finished the assignment! haha me so happy! of course... jlh helped me haha... but i get it now and i've done it! woo hoo! :D
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
does anyone know what ENCRAPTION is??


hahaha!! :p
 
Last edited:

bong

Member
Joined
Jun 11, 2003
Messages
433
Gender
Male
HSC
2003
lol!!

hey, wat did u guys set as the output if some idiot decides to put a zero in the input?
 

pb

Inside The Hollow
Joined
Jan 20, 2004
Messages
775
Location
Westie!
Gender
Female
HSC
2003
haha... throughout all the assignment pages, they have pretty bad grammar.

Oh yeh lol bong... i didn't even think of that. Mine comes out as P1 and I'm gonna leave it like that cuz whoever puts 0 is an idiot.
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
oh yeah i didn't consider a zero input.. oh no!!
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
ok now its taken care off..
thanks for the tip bong.... for your help i'll post what i put if the user inputs zero's:
Code:
       if (dimension1<=0 || dimension2<=0)
          cout <<"please input values that do not equal zero or are negative numbers!" <<endl;
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
or should the message say "NOT IN STOCK"??
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
looks like submit has been changed again..

there is a different link to submit the bonus (bonus_optimize.cpp) file...

damn stupid chris and all these changes...
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
mines 50 lines.. but with spaces between the if/else if statements...
 

jlh

sooner or later...
Joined
Mar 15, 2003
Messages
1,755
Location
Sydney
Gender
Male
HSC
2002
just a question...
does anyone have any output (( "<<cout" )) message when the open the .exe file??

i mean is it just meant to have a blank screen thats awaiting for input from the user...

OR

are you meant to have something like "enter the dimensions of the plank...:"
 

bong

Member
Joined
Jun 11, 2003
Messages
433
Gender
Male
HSC
2003
from the faq page, we dont have to worry about negatives, and no user prompts, so the only output will be either not in stock or a size, but a zero? lol,

yeh, 50 lines, all spaced out
 

Users Who Are Viewing This Thread (Users: 0, Guests: 4)

Top