No, you don't need to know C to learn C++. C++ is derived from C with a lot more features and capabilities.
Type: Posts; User: webren
No, you don't need to know C to learn C++. C++ is derived from C with a lot more features and capabilities.
float operator/(int x, const percent& y)
{
float a, b;
percent e;
a = e.getpercent();
b = a / y;
return b;
}
Isn't that a flaw in my program that the function to multiply a number by a percent relies on the function to multiply a percent by a number?
Also, I try to call getpercent() in my second...
So the function that returns y * x depends on the other operator* function (the one that multiplies the percent by a number)? If this is so, is it because that function has a base case?
How would...
Thanks Thantos.
7stud, I understand a little better now. Thank you. Using Thantos's advice (but changing some things around to get rid of errors), I got my program working, but I am confused...
I am a little confused.
percent operator* (int, const percent&);
Why isn't there a variable name after int and percent&?
I understand you don't have to have any, but how would you manipulate...
What would the function need to look like to be able to do c = a * f?
I keep receiving this error when trying to overload the * operator to multiply an object by an integer:
" error C2677: binary '*' : no global operator defined which takes type 'class percent' (or...
I finished studying recursion and was wondering. I definitely wouldn't limit myself to one or the other, but I was curious.
Thanks for the replies.
I was wondering if anyone knew of any programming languages that only allowed iteration and not recursion, and of any programming languages that allow only recursion and not iteration.
Ah, thanks for helping me recognize the problem. I actually never compiled the code. Maybe that's bad practice-I don't know. I just typed it all up, compiled it and eventually got rid of all the...
Hello,
I wrote a program using classes to get myself more familar with OOP. I got my program error free, but whenever I run the code, the program crashes. Any hints on why would be greatly...
Since the function is supposed to return a boolean value, whatever you want to return needs to have "return" in front of it. So just like The Brain said, and as you already realized, you need the...
Hello,
I am trying to write a program that will simply output the sum and product of complex numbers. I am having a difficult time getting it to work properly. Any ideas would be appreciated. ...
Ah, stupid mistake. Thanks.
Does anyone know how to get rid of this error and where it comes from?
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/Programming_Project_2.exe : fatal error...
The first while loop is there so if the user enters a zero, I want the program to end. If you want my entire coding, here it is:
#include <iostream>
#include <string>
#include <cctype>
...
Hello,
I have created a basic palinedrome program that works fine when obtaining words using commands like
cin >> input;, but I would like to elaborate and gets full sentences as inputs. I...
Pretty much got it working. The problem was the front not being initalized to zero when a new word would be entered.
For the discarding whitespaces, I'm sure there is an isspace command.
Hello,
What I am trying to do is create the classic palindrome detection program. I am having quite some trouble to get it working properly. The problems I am having are:
1) Whenever a string...
Ah, good call. Thanks for the advice, tripper.
Also, thanks for all your help, Mr. Wizard.
Ah, okay it works now. Having the if statements the way they are aren't going to cause bugs in the program, will they?
How can I do some checking for the first character being capitalized or not?...
I re-wrote the program like this and it's working a lot better than the previous one. Instead of states, I used colors. The only problem now is that you can enter every color, but none of them will...
The program listed below lets a user input a state, and the program tells the user if that is the state that the program randomly picked (from the enumeration block)...but I'm having a hard time...
This is what I have so far. I think I'm in the ballpark, but not fully there yet. Any ideas would be great.
#include <iostream>
#include <string>
#include <stdlib.h>
#include <time.h>
...