void bookType::checkTitle(string chkTitle, bool search)
{
//Search for title
if (chkTitle == bookTitle) {
cout << "1 Book(s) found with that title.";
search = true;
...
Type: Posts; User: jimzy
void bookType::checkTitle(string chkTitle, bool search)
{
//Search for title
if (chkTitle == bookTitle) {
cout << "1 Book(s) found with that title.";
search = true;
...
Different number of stars is printed, depending on score.
But still, wouldn't it be nicer to split this code into functions (big if-else-if I mean)? It looks like could be easily unified, using...
If you call isLarger() in CDate class, you might want to dereference 'this' when passing to function, as it is pointer.
isLarger(*this, secondDate)
instead of
Once you have function declared to take arguments by references (as laserlight proposed), you simply call it this way:
CDate firstDate, secondDate;
if ( isLarger(firstDate, secondDate) )...
Oh, thanks a lot brewbuck, works now :-)
Hello,
As I'm writing some simple email server app, I decided it's probably good idea to create my very first makefile.. Guess it didn't go that well... :confused:
OBJ = main.o...
There's a Project Mono, attempting to make .NET available on other platforms (I've seen it running on Linux).
I'd also recommend going for C# when it's about .NET and sticking to native C++...
Or, he could use a kind of bitmask (that could be a copy of given string, since he said he cannot use arrays), and while iterating for matches in original string, set 0,1 (or some other value you...
Also, first you should get the number, and then pass it to function that will display table. At the moment you're doing it in wrong order.
Not sure if that's what you mean, but I run into something that solves the whole reference problem, let's say:
public ref class Foo
{
int^ var;
public:
Foo()
{
That's what I'm doing now, was just hoping somebody knows more "managed" solution to such problem :-)
Yes, it seems so. However, second window class (as in my example) is supposed to be managed too. Thing is, managed objects cannot by passed by native C++ reference (&) (even to managed class' own...
Well, I need original values to be modified, and passing by value won't help then. Question that remains unaswered is, how to pass managed class data by reference, if that's even possible. (as for...
Hi there,
To quickly ilustrate my problem, say I got a ref class that's creating a window, with some variable as well as handle to second window which should modify mentioned variable, eg:
...
Since pointers and references are being discussed, I just thought somebody could clear this up - which of following functions is more appropriate to use in C++? Or maybe there's a "better" C++ way of...
As robatino explained.
By assigning 0 to result, this
if (result = 0)
{
// ...
}
won't be true, and code inside this if won't execute. Same story goes for:
Is this really what you meant?
You could put part of the code that's displaying menu-info into separate function, eg.
void printMenu()
{
printf("1.) Integer to Binary converter\n");
printf("2.) Fibonacci...
int main()
{
//Input variables
greet();
calc();
display();
return 0;
Okay, maybe I could help here:
int main (void) // see FAQ entry here
{
int number, bin, counter = 0; // you're starting accessing array at first index, which is 0
char bina[32];...
I'm not sure if I understand you correctly, but if you want to convert int to displayable binary, one quick approach would be to store remaining parts of division (which is either 1 or 0) in char...
Did you look at strcpy prototype?
char * strcpy ( char * destination, const char * source );
Perhaps you could try this:
int** foo(int x, int y)
{
int** arr = malloc ( x * sizeof( *arr ) ); // allocate memory for rows
int i;
for ( i = 0; i < x; i++ ) // for every...
Problem lies in this loop stop condition -
for (i = j; i >= n; i++)
Think about any input, and how many times will this loop execute. It's for negatives, just remember.
Ahh... thanks a lot matsp, knew it was going to be silly :confused: