Quote by CaptainRon

#include <iostream>
using namespace std;

int main()

string openorclosed; //string for user input for type of mortgage
string open = "open"; //string for open
string closed = "closed"; //string for closed
double termlength = 0; //initializing variable for the length of term input

//defining variables to eliminate magic numbers
double lengthone = 0.5;
double lengthtwo = 1;
double lengththree = 5;

//asking for type and duration of mortgage wanted and storing in defined variables
cout <<"What type of mortgage would you like (open or closed)? ";
cin >> openorclosed;
cout <<"How long of a term would you like?";
cin >> termlength;

if ( openorclosed == "open" ) //if the user input is "open", proceed to inner if statement
if ( termlength == lengthone ) //comparing user input with defined mortgage length
cout << "Mortgage rate is 7.10%"; //output if above is true
else if ( termlength == lengthtwo ) //if above is false
cout << "Mortgage rate is 7.50%"; //output if above is true
else ( termlength != lengthone || termlength != lengthtwo ); //if user input does not equal defined term lengths
cout <<"Sorry, open mortgages are only offered in term lengths of 0.5 years and 1 year" << endl; //output message
else if ( openorclosed == "closed")
if ( termlength == lengthone )
cout << "Mortgage rate is 5.30%";
else if (termlength == lengthtwo )
cout << "Mortgage rate is 5.00%";
else if (termlength == lengththree )
cout << "Mortage rate is 5.75%";
else if ( termlength != lengthone || termlength != lengthtwo || termlength != lengththree )
cout << "Sorry, closed mortgages are only offered in term lengths of 0.5, 1, and 5 years";

cout << "Sorry, we only offer open and closed mortgages" << endl;
return 0;

Alright, so we're supposed to write a program that will ask the user what type of mortgage they would like (open or closed) and how long of a term they would like. The program will then display the mortgage rate (if it's available).

My problem is when I compile the program, and input open mortgage for however many years, the program outputs all three cout lines.

I have changed the code above.

When you use 'else' you didn't need that bit in brackets. It works fine for me now.


    else ( openorclosed != "open" || "closed" );
    cout << "Sorry, we only offer open and closed mortgages" << endl;

There was your problem.
Quote by jimmy_neutron
Mogwai have three dates announced in Ireland, but the one closest to me (3 hour drive), is on bloody valentines day....

I only just found out about that now, fairly excited alright! I need to find a friend that will go with me. If I introduce one to Mogwai now they'll have time to get past the 'but it's got no words' phase.

Idioteque - Radiohead
Quote by wizards?
That song is actually called, Untitled, (Popplagið. Now I have no idea what that means in english though.

That was a name given by the band after the album was released, it means 'The Pop song'. All the tracks 'officially' have no title.
Mine changes often, and I have a few of them at any one time, but the one that's always stuck is 'Untitled #8' by Sigur Rós. Despite my dislike of the word, that is a truly 'epic' song.
I got 18.

Quote by Don_Humpador
Seems like everyone has the most problems with the blue/green area in the middle of the spectrum. Interesting.

Yep, looks that way. It's where I had slight problems.
Quote by justinb904
Anyone know of a good site that has tutorials and whatnot for learning C? My textbook is only marginally helpful and I've found which has been helpful but I'm looking for a site that gives a lot more in depth info.
Thanks in advance

Search youtube for 'c programming'. Some tutorials by a user called the new boston should come up. He has about 20 I think.

EDIT: Hang on, maybe that's a bit beginner focused for you. There might be other youtube videos showing what you're looking for though.
Quote by Jk47_
we get that the post was shit. Lets end it here.

Quote by Baby Joel
Because this is important, and it went unnoticed, I'll quote this so hopefully I could get help on anything. :/
If none you guys want to answer, or know the answer, or whatever, what other forums would you recommend going for this?

I'd go WD again. All hard drives fail eventually, it's just a gamble of when, regardless of manufacturer. WD tend to make fairly good quality stuff.

Something like this maybe?
Edit, whoops, I only read the last 20 pages.

As you were.
Thought I'd bump this thread as it finally inspired me to get a new wallet. I bought this on ebay about 17 minutes ago:

I like it.
Quote by poipoi

Because it is awesome


Hey everyone, what do you think of these guys? They're from Dublin. I saw them in August and was very impressed. Halves - May your Enemies Never Find Happiness.
I saw this on an episode of House once. The woman couldn't cry. Looking it up now, she had a fungal infection, candidiasis. I'd get yourself checked out..
Quote by Co&Ca11
Sounded kind of like a Japanese version of newer Avenged Sevenfold but with less obnoxious instrumentals to me. Not really huge on the vocals and nothing stood out to be. 3/10

5/10. The music at the start was nice, the singer annoyed me somewhat though.
Quote by Carswell98

What he said.
Space Oddity - David Bowie
The Drugs don't Work - The Verve
Kids - MGMT
Every song from ( ) by Sigur Rós.
Quote by ShallowEndings
Greetings, need some help with Firefox please.

Whenever i view an image, say i select the larger image from google, it resizes it too far.. i don't click enlarge or anything, but when i select that tab to view it makes it bigger than the maximum size so parts are slighty blurred. Only starting doing this yesterday..


You could try this add-on?

I've used it for ages, it lets you decide how much larger or smaller you view the image, or any image on any website.
2/10, not my type of thing.

Nyctalgia- Falling into Nothingness
I searched, but found nothing. This is the thread where we post our favorite desktop wallpapers for others to save and use. Original files only please, not screen shots of your desktop (that's for This thread).

There's a million Euro buried in...

Then die.
Quote by FaDe2bLaCk242
I have a question. Is This a good laptop choice for me? Let me explain to what I'm looking for: a laptop for school and casual games (some FPS's, but not many and not modern ones.) My price range (strictly) exceeds to no more than $800. I know it doesn't say it in the specs, but the battery life is around 5 hours. Is it a legit notebook for me? I mostly picked it out because of its Video card. It seems like the best one i could get for that price, especially with the seemly decent laptop to go with it.

There's more than one spec options on that site, which is the one that you're thinking of buying?
Yes, it's just the default KDE background, but it's nice. (I usually use GNOME)

'And if she doesn't, I do. '
Waiting to find out if I can go to town tomorrow with my girlfriend, waiting for Sunday when I see her at my house, waiting for Tuesday afternoon when my new computer desk arrives for the computer I just finally finished building, waiting to find out if I get paid tomorrow. Bout it.

Hayden Panettiere, Marisa Tomei, Jennifer Morison and Mischa Barton.
"Google was at the right place at the exact right time."

Planet Google-How One Company Is Transforming Our Lives. - Randall Stross
I was actually able to fix it. The fine folks at the Linux Mint IRC Chat helped me out. Thanks for the offer to help me though. I appreciate that.

Great! The Mint IRC Chat being there in the menu is a great help. No problem, hope you're enjoying Mint.
Well, I'm still really liking Linux Mint. I'm just having one problem with it that I'm not a fan of. The resolution just isn't that great. I've tried adjusting it and when I went to the correct resolution the colours on my screen went all out of whack. Now I can't even choose the correct resolution. What should I do? I can just reinstall it if I have too. I haven't done a whole lot of customising to it yet.

Sorry to hear about your problem. Nothing like this has ever happened to me, probably because I'm running on board Intel Graphics from 2005 . However, a quick Google tells me that this happens often. If you could post some more detail (graphics card model, monitor and resolution you want to get) I'll help you out the best I can.