Thanks! I didn't even think to look at the braces.
I have just one more question; my original test expressions for the carrying of pounds and shillings (20 shillings = 1 pound, 12 pounds = 1...
Type: Posts; User: Tride
Thanks! I didn't even think to look at the braces.
I have just one more question; my original test expressions for the carrying of pounds and shillings (20 shillings = 1 pound, 12 pounds = 1...
I'm trying to write a program that adds two money amounts in old-style British currency---pounds, shillings, pence---and asks if the user wants to continue. It also adds a pound every 20 shillings,...
Thanks guys :). That's much simpler than I was expecting.
Here is what I already have:
#include <iostream>
using namespace std;
int main()
{
int rows;
My book says to, as an excercise, make a pyramid of Xs 20 lines long, like this:
X
XXX
...
Ahh, that was my problem. Sorry, I just started programming in C++ after learning C for around half a year.
Thanks everyone!
Oh, well that's good to know :)
Do you have any idea how I might change that? I'm using Microsoft Visual C++. I don't know how similar compilers are, but if you're not using the same one do you...
One last question, when I delete the .h from iostream I get this error:
fatal error C1189: #error : "eh.h is only for C++!"
Why does it do this?
Thanks, maybe I'll get a new book. I was hoping this one would be really good because the reviews I've seen for it have said that it's a very good book for learning C++.
I just started C++ and I bought a few books. One of them, which I'm reading right now, has this code that I'm supposed to type in and learn how it works, but it has 4 errors when I compile:
...
Man, I wish I saw all of that John Titor stuff while it was going on. I probably would have been very interested in it.
Here's the one that gets my vote:
March 8, 2003
It wasn't well...
Check out the today's FoxTrot strip:
FoxTrot strip
I just thought it was kind of funny. FoxTrot is a funny comic strip (one of the best comics still going), but sometimes it has jokes that not...
Hmm... I had the idea that type double variables could have their value displayed using %d if the value was an integer. Thanks for clearing that up!
And about EOF, is it just an unseen character...
Changing the "%d"s to "%f"s (the ones that properly need to be changed) produces weird results of very large negative numbers. Is there something else in the code that is wrong?
This program that I wrote is supposed to get 3 sets of 5 numbers from the user and get the average of each set, but it's not getting the correct average for some numbers.
Here's the code:
...
All right. Thanks;)
But how does making a second getchar() achieve this? Why doesn't while ((ch = getchar()) != '\n') work the same way? And every input has a '\n' at the end of the line by default, correct? So if I...
Sorry, I posted before you edited.
I tried opening the first link but it wouldn't. Maybe I'll try with another browser. Thanks!
EDIT:
Sorry to edit, but I'm still not quite understanding...
Thanks, guys!
But Dave, with the code you gave, it still has one problem that it had before. It tells me that my input is invalid and then it's fine on the second try every time after the first...
I'm having trouble making fail-proof programs with menus and input and such. There are just some things that I've tried to learn and figure out but can't. I figure I should learn what these things...
You guys have been a big help. I understand it now :D. It seems so simple---I can't believe I didn't know how to do it!
Well, you've all saved me a lot of trouble. Thanks!
Using a for loop, correct?
Maybe this is my problem; what do I compare the element to to decide that it is the biggest so far?
Hmmm.. Both codes contain some things that I'm not familiar with. I only semi-understand what's going on in them. Maybe I should just go through my book again.
Thanks anyway, guys! :)
The book I'm reading says to make a program that shows the difference between the largest and smallest elements of an array. It sounded easy and I thought I'd be able to do it, but man, I've been...
Ooohh, so after I alter two variables from main()----let's call them a and b----in a function and return the result back in the variable "result" again, I'm sending the updated values for both a and...