1,288 Posted Topics

Member Avatar for lbgladson

Your setWidth and setHeight functions have paths that do not return anything. That doesn't seem to matter since you never call these functions anyway. You never set the width and length of rectangle [B]a[/B]; not even to default values. They could be anything. What are the rectangle class variables [B]x[/B] …

Member Avatar for Moschops
0
1K
Member Avatar for triumphost

I suggest using easybmp. It's very easy. [url]http://easybmp.sourceforge.net/[/url]

Member Avatar for triumphost
0
201
Member Avatar for sharathg.satya

An array is just many of the same object next to each other in memory. A vector is a proper C++ container class with an accompanying set of functions for interrogation and manipulation, able to manage its own resources, and to which numerous other C++ facilities such as the algorithms …

Member Avatar for sharathg.satya
0
118
Member Avatar for N.M.VIVEK
Re: OOPS

Keeping track of vehicles parked in a garage. The garage is an object. It can contain a variable number of vehicles. Each vehicle is an object.

Member Avatar for thines01
0
125
Member Avatar for DarkPyros

When you enter the second number (y) as 0, this line: [B]printf("\nThe Quotant of %d and %d is: %d.",x,y,x/y);[/B] attempts to divide by zero. This is bad and it makes your program abort execution. I see that your code contains a logic check for [B]y[/B] being set to zero; unfortunately, …

Member Avatar for Moschops
0
305
Member Avatar for mrprassad

Did you actually mean this? It produces quite different results: [CODE]main() { char *p="dcis"; while(*p++!='\0') printf("%s",p); }[/CODE]

Member Avatar for Moschops
0
200
Member Avatar for XO39

The order in which they are to be evaluated is not defined by the language definition. Therefore, it is [I]un[/I]defined.

Member Avatar for XO39
0
179
Member Avatar for RavesCoder
Member Avatar for jaskij
0
175
Member Avatar for DarkMonarch

Dev-C++ is a bad idea (at least, the one from Bloodshed is). Read this, pick something better. [url]http://www.cplusplus.com/articles/36vU7k9E/[/url] What's this it says halfway down the page? [B]Be careful doing this, though, as having two versions of MinGW might trigger linker errors ("undefined reference to __cpu_features_init"). [/B] That sounds familiar.

Member Avatar for DarkMonarch
0
265
Member Avatar for hekri

[QUOTE]"#include <ctime>" tells the linker "look in the ctime library for functions." [/QUOTE] [B]#include[/B] does not tell the linker anything - it is an instruction for the preprocessor.

Member Avatar for hekri
0
3K
Member Avatar for Ararat

[CODE] char*temp = a[0]; // make a new pointer, and point it at the char in a[0] strcpy(a[0],a[1]); // Overwrite the char in a[0] with the char in a[1], so now a[0] is 'b' strcpy(a[1],temp); // overwrite the char in a[1] with temp, which is the char in a[0], which …

Member Avatar for Ararat
0
112
Member Avatar for DazedanConfused

Here is how to define a class: [CODE]class nameOfClass{ // variables int x; string y; // functions int someFunction( float inputParameter); }; [/CODE] Now you do it for odometer class.

Member Avatar for Zvjezdan23
0
346
Member Avatar for sushlet

[B]addEntry[/B]'s third parameter should be a string, according to the declaration of the function, but you're passing it a pointer to a string. Likewise [B]deleteEntry[/B].

Member Avatar for sushlet
0
5K
Member Avatar for triumphost

Use GetLastError [url]http://msdn.microsoft.com/en-us/library/windows/desktop/ms679360(v=vs.85).aspx[/url] for more information.

Member Avatar for triumphost
0
2K
Member Avatar for Captain Neo

Is that not supposed to happen? If not, why did you code it that way? Read this [url]http://www.daniweb.com/software-development/cpp/threads/78223[/url] and ask again.

Member Avatar for PrimePackster
0
136
Member Avatar for capton

[QUOTE]also want to end executing a function of type void without allowing it to end but don't know how.[/QUOTE] Stick [B]return;[/B] where you want it to end.

Member Avatar for AceStryker
0
2K
Member Avatar for srinidelite

[CODE] int main() { int a[10][20][30][40]; a[0][0][0][0] = 314159; a[0][0][0][1] = 1414; int *p = &a[0][0][0][0]; printf("%i \n", *p); p++; printf("%i \n", *p); return 0; }[/CODE]

Member Avatar for Moschops
0
79
Member Avatar for naraayanan
Member Avatar for Moschops
0
69
Member Avatar for 8367144q

[CODE]for (int counter = 1; counter <= ending; counter >= beginning; counter++)[/CODE] This is wrong. The [B]for [/B]loop takes only three statements in the brackets. I suspect you meant something like: [CODE]for (int counter = beginning; counter<= ending; counter++)[/CODE] [CODE]while (value <= ending; value >= beginning; counter2++)[/CODE] This is wrong. …

Member Avatar for Moschops
0
144
Member Avatar for hamby

To do so, you'd either have to use global variables (not good) or use [B]new [/B]and [B]delete [/B]to extend object lifetimes. A simpler way is to just use parameters in your functions. It's what they're for. [CODE] string inputsentance() { string sentance; cout<< "inputsentance"; cin>> sentance; return sentance; } string …

Member Avatar for Moschops
0
169
Member Avatar for ChrisMackle

Presumably you're not running it from console - you're pushing a button somewhere to make it run. As such, something else is opening a console window for you. When the program finishes, why would that console window stay open? [url]http://www.cplusplus.com/forum/beginner/1988/[/url]

Member Avatar for m4ster_r0shi
0
316
Member Avatar for kartik bodala
Member Avatar for Karlwakim

[QUOTE]Is Directx efficient for GUI apps ?[/QUOTE] The short answer is no. DirectX is vastly overpowered (and consequently excessively low-level) if you just want to knock together GUI apps. The common approach is to pick a suitable widget toolkit for your needs and system, and use that. Here's a list: …

Member Avatar for LRRR
0
152
Member Avatar for Karlwakim

Read this: [url]http://www.cplusplus.com/articles/EN3hAqkS/[/url] and then this: [url]http://www.cplusplus.com/articles/z186b7Xj/[/url] and then if you still don't se any use for them, come back and ask again.

Member Avatar for rubberman
0
172
Member Avatar for Vermouth

Don't use char arrays. Use a single array of C++ strings. Then use the sort function. [url]http://www.cplusplus.com/reference/algorithm/sort/[/url] Don't use [B]void main()[/B]. It's wrong. Use [B]int main()[/B]

Member Avatar for adityatandon
0
599
Member Avatar for ben1996123
Member Avatar for adil.h

[code]static int Decode_VL64(const std::string &data){ char* chars = (char*)data.c_str(); return Decode_VL64(data); }[/code] This function will never, ever end. It's recursive. You're calling the function again at the end every time, over and over and over and over and over...... until finally the stack has no room left to call the …

Member Avatar for Moschops
0
803
Member Avatar for ThomsonGB

There is an issue in how you went about creating the array of char: [CODE]char * ptrNewBuffer = new char[STRING.size() + 1];[/CODE] At the point of creation of this array of char, what is the size of STRING? Later in the code, you will repeatedly attempt to copy a line …

Member Avatar for ThomsonGB
0
267
Member Avatar for ben1996123

[B]undefined reference[/B] indicates that the compilation is fine, but the linking is not. Check which libraries you need to link against. Linking just against glut32.lib is not enough.

Member Avatar for Moschops
0
560
Member Avatar for smurfy

I am sure we already solved this. [url]http://www.daniweb.com/software-development/cpp/threads/401547[/url] [QUOTE]It would be better a better if i have another solution,idea for the issue. [/QUOTE] We gave you a working solution. What's wrong with it?

Member Avatar for smurfy
0
147
Member Avatar for kris kannan

Very few target DSP processors support windows.h ;) I suspect easybmp would be relatively easy to port over to DSP.

Member Avatar for kris kannan
0
419
Member Avatar for jimmymack

[B]I don't understand them at all.[/B] Do you understand what's meant by [B]A or B[/B] ?

Member Avatar for v3ga
0
122
Member Avatar for esesili

There are many, many many options. Here's a list: [url]http://en.wikipedia.org/wiki/List_of_widget_toolkits[/url] QT4 has a good reputation, for good reason. Have a look through the others as well and pick the one that best suits your needs and abilities.

Member Avatar for LdaXy
0
329
Member Avatar for Goshutu

Unresolved external symbol generally means you've not linked to the right library, or you haven't written a function you need. The following code is fine. Can you build it? [CODE]#include <vector> #include <iostream> using namespace std; class CPiece { public: vector<vector<int> > piece; CPiece() :piece(4,vector<int>(2)) {} }; int main() { …

Member Avatar for Goshutu
0
347
Member Avatar for smurfy

What is the possible range of values for each of a,b,c,d? Zero to nine? If so, then this might do what you want. If you can guarantee that the type of array is [B]int[/B], it can be simplified. [CODE]array[i] = 1000 * a + 100 * b + 10 * …

Member Avatar for nina@cika
0
351
Member Avatar for qmanchoo

You are passing the function a copy of a pointer. That's what happens when you pass by value like this. A copy of the object is made, and given to the function. The function then changes that copy (note that you're not changing what the pointer points at; you're changing …

Member Avatar for Moschops
0
114
Member Avatar for snowhite89

[B]read from input file using C[/B] Did you mean C, or do you mean C++? You're using C++ (a very old C++ that will not work on modern compilers; looks like pre-standard C++ to me, as if you were using a decade old compiler... using Dev-C++, by any chance?)

Member Avatar for Moschops
0
268
Member Avatar for whitech

See this: [B](y1+y2)/2[/B] The answer to thins will be an integer, because y1 and y2 are integers and you're dividing by an integer. So if y1=0 and y2=3, the answer will [B]not[/B] be 1.5 If you want non-integer answers, you have to turn the input into double or float.

Member Avatar for whitech
0
330
Member Avatar for LdaXy

Depending on the standard that the original coder coded to, you might be able to get away with very little work. Valid C code is valid C code, regardless of whether it's on *nix or Win32. The issues generally arise when libraries are available on one system and not the …

Member Avatar for Moschops
0
115
Member Avatar for caba992

A C++ compiler will happily compile the following code. [CODE]#include <iostream> #include "stdio.h" int main() { std::cout << "Hello "; printf("world"); return 0; } [/CODE] C++ is (almost) a superset of C. If it's valid C code, it's valid C++. The only time one has to be careful is linking …

Member Avatar for Moschops
0
257
Member Avatar for maryam ahmad
Member Avatar for maryam ahmad
0
1K
Member Avatar for cppluvr

[CODE]if (input == "%INSERT") { while(input != "%DELETE") { inFile >> nm; inFile >> num; cout << nm << num << endl; } }[/CODE] This looks like an infinite loop. You establish at first that input is %INSERT, and then you keep reading in for as long as input does …

Member Avatar for Lerner
0
226
Member Avatar for MugANDGlass

Are you simply trying to set the values? Here is how you would set the value of [B]newptr->title[/B] to that of [B]title[/B] [CODE]newptr->title = title;[/CODE] The rest are very similar. I suggest that since year and price inside your book object are not strings, that you actually make them an …

Member Avatar for MugANDGlass
0
360
Member Avatar for vyrte

So [B]value[/B] is a pointer, that is supposed to point to an object of type [B]Value[/B] (awful choice of name for your pointer, by the way; really, really awful - if you can't think of a better name, at least call it something that makes it clear it's not Value …

Member Avatar for Moschops
0
133
Member Avatar for Jim887

[B]void main()[/B] is incorrect; if your compiler doesn't complain, throw it away and get a modern, better one for free.

Member Avatar for Moschops
0
115
Member Avatar for solid222

[QUOTE]That solved the problem, It turned out I needed to use pointers to solve the question[/QUOTE] Preferably references. Pointers are a waste of processor when you can use references instead.

Member Avatar for Moschops
0
155
Member Avatar for Hamilton89

[CODE]while(random_temp != 17,18,19,20,21,22,23,24)[/CODE] That's just plain wrong. I suspect you meant: [CODE]while(random_temp != 17 && random_temp != 18 && random_temp != 19 && random_temp != 20 && random_temp != 21 && random_temp != 22 && random_temp != 23 && random_temp != 24)[/CODE] which can be more elegantly put [CODE]while(random_temp < …

Member Avatar for mikrosfoititis
0
741
Member Avatar for twistercool

Firstly, void main() is non-standard. Just because it works using your current compiler on your current operating system in your current hardware is no guarantee that it will work elsewhere. Deliberately writing programs like this is foolish when you could just write [B]int[/B] instead of [B]void[/B]. Here is a page …

Member Avatar for Moschops
0
277
Member Avatar for subith86

[QUOTE]something like pass by reference[/QUOTE] I can only show you actual pass by reference, not something like pass by reference. [B]void function(char*&);[/B]

Member Avatar for subith86
0
179
Member Avatar for SCass2010

[CODE]#include <iostream> int main() { char* p = "eggs on toast"; void* q = (void*) p; // to void*... char* r = (char*) q; // and back std::cout << r; return 0; }[/CODE]

Member Avatar for SCass2010
0
1K

The End.