1,296 Posted Topics

Member Avatar for CoolGamer48
Re: hpp?

Look at an interesting discussion about C++ file extensions: [url]http://stackoverflow.com/questions/152555/h-or-hpp-for-your-class-definitions[/url] There are others C++ header file extensions in use: .hh, .hxx et al

Member Avatar for ArkM
0
139
Member Avatar for brechtjah

Some notes about isdigit and non-ascii characters: The isdigit is a C library function (the C library is a part of C++ library) so let's open the C language standard: [quote]The header <ctype.h> declares several functions useful for classifying and mapping characters. In all cases the argument is an int, …

Member Avatar for brechtjah
0
169
Member Avatar for tpluscomb

Think a little: 1. Look at the partition returned type: must be const Type& or int ??? [code=cplusplus] template< typename Type > const Type &partition( Type* array, int low, int high ) { int left, right; ... return right; // integer value returned, not const Type& !!! } [/code] Look …

Member Avatar for ArkM
0
921
Member Avatar for laki234

Alas, probably not only division is not working for ALL numbers in this code... Can you explain what are you doing?

Member Avatar for William Hemsworth
0
246
Member Avatar for NinjaLink
Member Avatar for j_p36

A rather strange loop, see what happens: [code=cplusplus] while (cardsRemoved<participants) { int r = 0; // r created on every loop, initialized 0 kanban[r][c]=kanban[r][c]-1; // always [0][c] = [0][c] r++; // incremented, but r shall die soon cardsRemoved++; // automatic r ended } [/code] Probably you forgot that the loop …

Member Avatar for j_p36
0
182
Member Avatar for brechtjah

[quote]...unsigned short integer is ALWAYS 1 char long[/quote] That's wrong statement. The "length" of unsigned short value is [icode]sizeof(unsigned short)[/icode]. The length of char value is ALWAYS 1 by the language definition. Now try to print [icode]sizeof(unsigned char)[/icode] and see what happens. 1. What's array called number type? Show me …

Member Avatar for brechtjah
0
191
Member Avatar for arreyes

Fortunately you CAN'T invent a "class of no designated size" in C++. For every class its objects have fixed and defined size (remember operator sizeof). If you mean a class with dynamically allocated members then it's a problem of this class constructor, not a vector container. That's why class constructors …

Member Avatar for ArkM
0
122
Member Avatar for tnvkrishna

Don't use Dev-C++: the project is frozen 1. VC++ 2008 Express: ~400 Mb (with MSDN Express) + >100Mb Windows SDK: [url]http://www.microsoft.com/express/download/#webInstall[/url] 2. Code::Blocks IDE with MingGW compiler (G++ from gcc family Windows port) -~20 Mb: [url]http://www.codeblocks.org/downloads/binaries[/url] Both compiler implement (almost) C++ Standard (if you don't use MS .NET VC++ "extensions"). …

Member Avatar for jbennet
0
219
Member Avatar for xlx16

There are interesting sentences about main in the C++ and C standards. C++: [quote]An implementation shall not predefine the main function. This function shall not be overloaded. It shall have a return type of type int, but otherwise its type is implementation-defined. All implementations shall allow both of the following …

Member Avatar for ArkM
0
96
Member Avatar for manzoor

What happens - see my post in the recent thread [url]http://www.daniweb.com/forums/thread156711.html[/url]. You can't modify string literal via pointers, on modern platforms you catch memory access exception. So in your 2nd snippet str2 points to the same C-string literal address - that's all. If you modify str1 value (for example, [icode]str1 …

Member Avatar for mujash.techee
0
130
Member Avatar for Lokolo

Fortunately, it's so simple: [code=cplusplus] std::string s; s = "Base "; s += "next item. "; s += "The end."; [/code]

Member Avatar for Alex Edwards
0
190
Member Avatar for atish00

1. We suggest a topic. 2. You create some problems. 3. We cope with your problems. 4. You have working Turbo C++ project. Right? ;) Free enterprise pattern w/o feed-back circuit... Human civilization was started from division of labor...

Member Avatar for atish00
0
79
Member Avatar for Elmismo

Insufficient info. As usually, no function definitions in the header. Where are these functions bodies? The linker can't obtain them. Check out all sources, libraries and the project settings.

Member Avatar for ArkM
0
368
Member Avatar for k59smooth

[QUOTE=k59smooth;738215]where can i get good a C++ compliler[/QUOTE] [url]http://www.codeblocks.org/[/url] [url]http://www.microsoft.com/express/download/#webInstall[/url]

Member Avatar for WaltP
0
116
Member Avatar for clutchkiller
Re: ios

[QUOTE=clutchkiller;738203]My dev-c++ compiler is telling me that ios::noreplace is not a valid member of std::ios. Why?[/QUOTE] Because no ios::noreplace in C++ at all (10 years or more): [url]http://www.devx.com/tips/Tip/14544[/url]

Member Avatar for clutchkiller
0
95
Member Avatar for kevintse

A reference in C++ is another name of an object. The fun() function returns a reference to the local int variable called a. After [icode]int& r = fun();[/icode] r is another name of INEXISTENT object: local (automatic) variable a (int object in automatic atorage - usually stack) of fun does …

Member Avatar for kevintse
0
73
Member Avatar for minas1

Alas, modern computers are very fast beastes but not so fast as you wish... Think: you define 600851475143 loops (~10^12 times). I'm too lazy to profile your code but I'm sure that your (and mine) computer is not capable to perform more than 10^8 (or near) this loop bodies per …

Member Avatar for Alex Edwards
0
127
Member Avatar for anny**

[code=c] while((ch==getche()) != 'd') [/code] I see you like C operator ==, but it's equal test operator, not assignment (operator=). You are trying to COMPARE ch with getche() returned value. But you never assign the value to ch.

Member Avatar for ArkM
0
96
Member Avatar for Arctic wolf

Regrettably, all <ctime/time.h> stuff does not bear a relation to the computer Real Time Clock device. Moreover, you can't directly access RTC in standard Windows user mode.

Member Avatar for Arctic wolf
0
654
Member Avatar for atman

Better read the excellent tutorial "All about pointers": [url]http://eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx[/url]

Member Avatar for ArkM
0
80
Member Avatar for f.ben.isaac

Of course, it's my opinion only: 1. ? Ask AV soft implementors ;) 2. Yes, of course. Look at the VC++ Project Types pane. If you wish VC++ generates code which does not depend on .NET framework. Of course, you can't use any .NET stuff in the code. 3. Yes …

Member Avatar for ArkM
0
125
Member Avatar for RaDeuX

Of course you have "memory leak" because you never deallocate pointers to dynamically allocated country names placed in dynamically allocated countryList array of pointers. You deallocate the array of pointers only.

Member Avatar for RaDeuX
0
114
Member Avatar for Undermine

In actual fact it does not matter in C and C++ where a function prototype was placed if it stands before function using. What a (bad) compiler are you using? Apropos, why you compute simplest x*x as pow(x,2.0)? You don't test input results. Try to enter (misprint) not-a-number... Avoid using …

Member Avatar for ArkM
0
105
Member Avatar for jianna

Why devious ways to go? [code=c] char* reverse_case(char* str) { if (str) { char* p; int c; for (p = str; (c=*p) != 0); ++p) if (isalpha(c)) *p = (islower(c)?toupper(c):tolower(c)); } return str; } [/code]

Member Avatar for WaltP
0
563
Member Avatar for jesseb07

Don't pursue mirages. Floating point arithmetics is binary, not decimal. Strictly speaking, no such double values as 0.45 or 0.1. Both real numbers are periodical binary fractions but it's impossible to represent infinite series of 0/1 exactly in 64-bit words (more precisely in 53 bits, see [url]http://en.wikipedia.org/wiki/IEEE_754#Basic_formats[/url]). All double values …

Member Avatar for jesseb07
0
271
Member Avatar for amt_muk

May be it helps: [url]http://support.microsoft.com/kb/90530[/url] I don't test it because I never used global variables (it's true ;) ).

Member Avatar for amt_muk
0
103
Member Avatar for Puliver

The [icode]assign(const char*)[/icode] wants C-string terminated by zero byte. You forget to assign [icode]buffer[lsize] = '\0';[/icode] after fread. It's enough to raise erratical memory access error in assign. Another notes: 1. No need to rewind pFile, use fseek again. 2. Think about exit() in C++ programs. Automatic objects destructors are …

Member Avatar for Puliver
0
474
Member Avatar for Jason123

There are (at least) two defects in this short solution: 1. Try to type "HowManyPhantomZeroesPushed:1-2-3-4-5..."... 2. Strictly speaking, the last char of std::string value[i] is not equal to 0. Index value must be less that value.length(). Declare a const char pointer initialized by value.c_str().

Member Avatar for ArkM
0
179
Member Avatar for love_dude1984

[QUOTE=love_dude1984;736520]hi everyone.. i just want to know which of following operator can't be overloaded. a)== b)++ c)?! d)<= hoping for a Answer ASAP with explanation.. thanks..[/QUOTE] At first find an error in your question ;)

Member Avatar for MosaicFuneral
0
68
Member Avatar for SQ89

No need in two loops. Search this forum for Fibonacci series (there are lots of recent threads on this topic).

Member Avatar for ArkM
0
76
Member Avatar for indiansoil

Well, it's so simple (in C++ ;) ): [code=cplusplus] struct Record { char q[100]; char a1[100]; ... Record() { memset(q,0,sizeof q); memset(a1,0,sizeof a1); ... } void read() { ... }; .... Record YourRecord; ... [/code]

Member Avatar for gagansharma
0
247
Member Avatar for minas1

Regrettably, this very strange operator+= overloading is legal in C++. Present the code fragment where these errors were detected. I'm sure it's wrong code fragment incorrectly used the 1st overloaded operator.

Member Avatar for ArkM
0
154
Member Avatar for dexter1984

What's a problem? Do not declare this static member array as const - that's all. At first YOU say to compiler that "it's a constant array, don't allow ME to change it" - then cry ;)...

Member Avatar for dexter1984
0
121
Member Avatar for laki234

Probably, semicolon or closed brace (or both) missed just before line 872 or near (may be in header file). Check syntax carefully. Look at the title of your post. Are you sure that it's an error in the C++ language or compiler? ;)

Member Avatar for ArkM
0
134
Member Avatar for mybluehair

Is it a joke? end == end is always true (if you don't overload operator ==, of course). What's a sense of humor ;)...

Member Avatar for skatamatic
0
110
Member Avatar for SarahYan

The yearofstart member of struct customer variable does not bear a relation to struct yearofstart variable. You don't initialize this last (of struct date type) member of customer. It's a global variable so all its members initialized with 0.

Member Avatar for SarahYan
0
117
Member Avatar for csaund1
Member Avatar for ArkM
0
187
Member Avatar for uw1

You must delete array pointer by [icode]delete [] pointer[/icode] operator. In other words a pointer obtained from [icode]new[][/icode] must be deleted by [icode]delete [][/icode]. Learn C++ more carefully ;) ...

Member Avatar for uw1
0
101
Member Avatar for En-Motion

Some notes about previous post. 1. The fgets function was supposed but an example used another function fgetc. It defines while loop incorrectly because s variable is uninitialized at the start loop moment. This loop icorrectly prints possible on eof returned value (see #2). 2. EOF is not "a special …

Member Avatar for ArkM
0
319
Member Avatar for taylorknox

Too many errors... That's your homework, not mine, so I can't write the right code for you. Some (free ;) ) advices: 1. Next time use code tag with language specifier: [noparse][code=c] ... sources ... [/code][/noparse] 2. Reread Runge-Kutta RK4 method description, for example: [url]http://en.wikipedia.org/wiki/Runge-Kutta[/url] 3. Declare all variables as …

Member Avatar for ArkM
-1
180
Member Avatar for Agni

Obviously it's not C++ issue. It's your DBMS issue. Use the DBMS transactions.

Member Avatar for Agni
0
91
Member Avatar for MosaicFuneral

Can you explain what do you want to do really? All presented code looks like an absolutely senseless coding exercise...

Member Avatar for ArkM
0
160
Member Avatar for skatamatic

Have you ever search INET for arithmetic expressions parsing&evaluation? Try that, there are lots of info and codes on this old good topic...

Member Avatar for skatamatic
0
198
Member Avatar for resduq

Use more compact, fast and robust stream control in the last function: [code=cplusplus] void somefunction(istream& bs) { string x; while (getline(bs,x,',')) cout << x <<'\n'; cout.flush(); } [/code]

Member Avatar for ArkM
0
164
Member Avatar for replic

It's a UNICODE string. Use WideCharToMiultiByte to convert share name to ordinar string. May be better try NetShareGetInfo? Apropos, "No special group membership is required for level 0 or level 1 calls" only...

Member Avatar for replic
0
462
Member Avatar for DLightman

No need to pass references to arrays. In actual fact a pointer to a 1st element of an array passed. Array contents never copied when passed as argument. What for all these ordinar functions are collected in a class?

Member Avatar for DLightman
0
88
Member Avatar for AcidG3rm5

Keep it simpler, it's C++, not Pascal ;) : [code=cplusplus] //checks for leap year bool checkLeapYr(int year) { return year%4 == 0 && (year %100 != 0 || year%400 == 0); }//end function check leap year//checks for leap year [/code]

Member Avatar for AcidG3rm5
0
166
Member Avatar for atman

[quote]it doesnt really explain whats going on under the hood[/quote] Ok, it's a simple but not a strong validation. For example, in most of C implementations scanf can't detect integer overflow (it's possible to type a huge number and to get some wrong number with scanf(...) == 1). More strong …

Member Avatar for ajay.krish123
0
120
Member Avatar for freelancelote

A string literal is a constant value in modern C and C++, so the pointer to it has [icode]const char*[/icode] type (not [icode]char*[/icode]). The Melarki constructor wants char* argument. Why? It's a very dangerous class. For example, your program is evidently wrong: Melarki destructor called for wholeMelarki will try to …

Member Avatar for freelancelote
0
621

The End.