1,296 Posted Topics

Member Avatar for vishy_85

1. You can't compile (and especially run) this snippet: the time library function has time_t* parameter, not struct tm*. 2. Use mktime instead of time 3. The time_t value is not seconds after epoch but you can compare these values.

Member Avatar for ArkM
0
1K
Member Avatar for power_computer

[QUOTE=power_computer;823312]Tried searching but everything seems to be for VB C++. Is this even possible in dev c++ if so please tell me how to do it[/QUOTE] Dev-C++ has no its own console window, it's Windows OS console window of your application started from the Dev-C++ IDE. VB C++ - what …

Member Avatar for nucleon
0
1K
Member Avatar for VarunV

[QUOTE=VarunV;822293]Can u help me in making a C++ code for simulating a bidirectional shift register??????[/QUOTE] May be you want C++ code for SHIFT AND ROTATE instructions? If so it is then combine << >> (shifts) & (bitwise and) | (bitwise or) operators - it's so simple ;)...

Member Avatar for ArkM
0
97
Member Avatar for arshad115

It's a wrong algorithm (bad code started from the second for loop). Look at working (but not optimized) code: [code=c++] const char* bstrstr(const char* s, const char* p) { if (s == 0 || p == 0) // guard return 0; int slen = strlen(s); // (astrlen;) int plen = …

Member Avatar for ArkM
0
253
Member Avatar for lllllIllIlllI

[QUOTE=arshad115;822201][B]stdio.h [/B] is used in vc6.0 and many other old programs. in VC2008 you use [code=c++]#include "stdio" [/code][/QUOTE] ???? Impossible! No such header as <stdio> (especially "stdio" ). Standard C stream i/o header is <stdio.h>. In C++ you may include it as <cstdio> - that's all... It looks like a …

Member Avatar for lllllIllIlllI
0
239
Member Avatar for jajafofo

1. Next time use code tag correctly: [noparse][code=c++] source(s) [/code][/noparse] No line numbers for a plain text (to refer for explanation). 2. A very simple logic (pseudocode): [code] loop get the next token if the token is operand then push it to the stack else if the token is operator …

Member Avatar for jajafofo
0
102
Member Avatar for etserrano

Evidently it's impossible to answer the question in common case. It depends on this port nature and features. If no underlied system provided events to wait and react on the port activity the only approach is a "busy wait" (probably it's your case). Possible approaches: - Set the lowest (at …

Member Avatar for etserrano
0
160
Member Avatar for lllllIllIlllI

Some additions: stdafx.h is Visual C++ specific pre-compiled headers artifact. In precompiled headers mode VC++ ignores all lines before #include "stdafx.h". You may switch on/off this mode in Project Properties | Configuration | C/C++ | Precompiled Headers tab.

Member Avatar for lllllIllIlllI
-1
693
Member Avatar for Evan M

A classical case. Only base class destructor called because your BaseFoo is not a polymorphic class. It can't deallocate any vectors in the derived class: it knows nothing about its descendants. Make it as a polymorphic class (fortunately, it's so simple) and see what happens: [code=c++] class BaseFoo { public: …

Member Avatar for Evan M
0
175
Member Avatar for NavidV

In C++ only a class with virtual functions is a polymorphic class and only these classes objects may have polymorphic behavior implemented via virtual function calls. In common case the classPointerObject pointer refers to the base class subobject of the derived class object - that's all. It's a simple is_a …

Member Avatar for ArkM
0
95
Member Avatar for man4ish

1. Use code tag: [noparse][code=c++] source [/code][/noparse] 2. As usually, such classes as Key and Value need user-defined copy constructors and overloaded assignment operators. Default ctor and operator= (member by member) are wrong. 3. What's your class dbmap definition? If it's std::map<Key*,Value*> then you can't get sensible map for Key* …

Member Avatar for BradenMurphy
0
184
Member Avatar for nexusdarkblue

Line #21 in main module: why type specifier in a function call?.. [code=c] find_departure(time,shedule); [/code] It's the same error as [code=c] void f(int a, int b); ... f(1, int 2); [/code] Congratulations, it's not a specific struct issue; stop your struggle, better read textbooks ;)...

Member Avatar for nucleon
0
240
Member Avatar for Ganahonic

Take your C textbook and look at the function definition paragraph. [code=c] void addit(int test1, int test2) { ... } [/code] ;)

Member Avatar for Dewey1040
0
81
Member Avatar for DemonGal711

1. Use code tag with the language specifier!!! [noparse][code=c++] source [/code][/noparse] 2. Where is your class definition? Where is your problem destructor definition? 3. >[i]but my compiler didn't like it[/i] Yes, I don't like it too. Probably it's a wrong code. Where are compiler diagnostic messages? See also #2... 4. …

Member Avatar for ArkM
0
1K
Member Avatar for NRaf

[QUOTE=nucleon;820950]Narue, can you really dynamically allocate a [b]static[/b] array in C99? Just seems odd. Is it only sized on the first call in your example?[/QUOTE] The C Std, 6.7.5.2: [quote]10 ... Array objects declared with the static or extern storage-class specifier cannot have a variable length array (VLA) type. ... …

Member Avatar for Narue
0
106
Member Avatar for codeman85

[url]http://www.dreamincode.net/code/snippet902.htm[/url] [url]http://www.algorithmist.com/index.php/Bubble_sort.c[/url] [url]http://www.dreamincode.net/code/snippet902.htm[/url] Get it as the basis of your code. Apropos, Google search [i]bubble sort c[/i] yields ~628000 references, [i]binary search[/i] >1000000 references...

Member Avatar for ArkM
0
95
Member Avatar for Dendei

[QUOTE=Dendei;818080]Hello i have an array of dates and want to input a week ex week #14 and get all the dates written out in that week. Anyone know a good way to convert weeks to dates or how i should solve this? thx for answer.[/QUOTE] 1. What's your "date"? You …

Member Avatar for Dendei
0
96
Member Avatar for pinky yohana

[QUOTE=pinky yohana;819564]i can't make this programs..some body,,please help me..[/QUOTE] What's a problem? Regrettably the title of your help request looks like absolutely senseless phrase...

Member Avatar for ArkM
0
34
Member Avatar for DemonGal711

If every node was created via [icode]new Node[/icode] construct, that's a Node destructor stub is: [code=c++] class Node { public: ... ~Node() { for (all_branches) // pseudocode! delete ith_branch_ptr; // this node destruction // code (if any)... } .... }; [/code] Now if the root is a pointer to the …

Member Avatar for DemonGal711
0
310
Member Avatar for vishy_85

Your function returns the 1st character only. Didn't you know that [i]char[/i] type is not the same as a pointer to char (array) char* type? Pass a char array (date string buffer) and its size as function arguments, for example: [code=c] void getcurrentdate(char* date, int datesize) { ... check up …

Member Avatar for Narue
0
100
Member Avatar for Mossiah

[code=c++] std::string& Reverse(std::string& s) { std::string::iterator f = s.begin(), r = s.end(); while (f < r) std::swap(*f++,*--r); return s; } std::string Reversed(const std::string& s) { std::string temp(s); return Reverse(temp); } [/code]

Member Avatar for iamthwee
0
162
Member Avatar for tux4life

Alas, you got char codes instead of integers. Try to run your code with debugger... [code=c++] const int NUMBERS = 5; int tux4life() { int num[NUMBERS]; const int n = sizeof num/sizeof *num; cout << "Enter " << n << " integers: "; int i; for (i = 0; i …

Member Avatar for tux4life
0
137
Member Avatar for BruenorBH

Have you ever seen Windows API file access function sugnatures? [code=c++] HANDLE CreateFile( LPCTSTR lpFileName, // address of name of the file DWORD dwDesiredAccess, // access (read-write) mode DWORD dwShareMode, // share mode LPSECURITY_ATTRIBUTES lpSecurityAttributes, // address of security descriptor DWORD dwCreationDistribution, // how to create DWORD dwFlagsAndAttributes, // file …

Member Avatar for BruenorBH
0
184
Member Avatar for tux4life

The MinGW is a native Windows port (without Cygwin) of the GNU C++ compiler. I think it's a good general purpose compiler. Both IDEs (Dev-C++ and Code::Blocks) use this compiler but the Dev_C++ is a frozen project - that's the long and the short of it. >I know there's Code::Blocks, …

Member Avatar for tux4life
0
170
Member Avatar for slimjimmer

Some addition: Don't forget: the scanf functions returns a counter of successufully processed format descriptors. It's the first stage of an input validation: [code=c] if (scanf("%d",&row) != 1) { /* 100% bad input */ } [/code] The second validation stage depends on input values, for example: [code=c] #define MAXROWS 100 …

Member Avatar for Salem
0
2K
Member Avatar for Vovka

>a misfortune happened, here unmaybe I in any way to complete work for a bank... Now I see why the Current::WorldFinancialCrisis happened :( Are you sure that these project "specification" are complete? ;) Read more: [url]http://www.daniweb.com/forums/announcement8-2.html[/url]

Member Avatar for Vovka
0
115
Member Avatar for karthik.c

1. Always use code tag for your snippets (aee this forum rules): [noparse][code=c++] source [/code][/noparse] 2. It's a very bad code. Avoid C++ program termination by C library function exit(). It don't call destructors so you can't terminate the program gracely. Probably the only proper method is an exception raising, …

Member Avatar for ArkM
0
104
Member Avatar for ademsaykin

Think also about "teen-th" sufficies. To get two last decimal digits of the number use [icode]n%100[/icode] exptression. Read about [b]if[/b] and [b]switch[/b] statements and [i]strcpy[/i] library function... and no problems...

Member Avatar for ArkM
0
132
Member Avatar for abhi_marichi

Please, never use [i]"system" command in C[/i] term in this context. No "commands" in C. The [b]system[/b] is a library [b]function[/b] in C...

Member Avatar for Narue
0
139
Member Avatar for bojomojo

Look at the time input validation stuff and try to adopt it for complex number input (and other user types): [code=c++] struct Time { int hh, mm; std::string ampm; // "AM" or "PM" }; bool getTime(std::istream& is, Time& t) { bool res = false; char c; if (is >> t.hh) …

Member Avatar for ArkM
0
202
Member Avatar for RexxX

In practice you never know what's a number of a future collisions. The first pass through the data file is not the best idea too. You can't estimate a number of different words without some kind of a dictionary so you have the classical chicken and eggs problem. In fact …

Member Avatar for Narue
0
151
Member Avatar for mimis

>I have to make a tree that will have unlimited leafs in each root. A tree has a single, unique root node (how about [i]in each root[/i]? ;)). It's not a problem to make a tree with unlimited number of branches in each node (for example, use vector of pointers …

Member Avatar for GDICommander
0
113
Member Avatar for jaanu.cheruvu

Evidently it's impossible in terms of element access counter because no direct access to list elements so you need ~n/2 accesses to fetch a given number from a list - [icode]O(n)[/icode] time complexity. If n denotes a number of comparisons - it's the other story. It's so simple ;)... PS. …

Member Avatar for jaanu.cheruvu
0
357
Member Avatar for nick2price

If you are trying to compile this Unix BSD-colored snippet on MS VC++ then have a look at [url]http://trac.osgeo.org/mapserver/ticket/602[/url] May be it helps...

Member Avatar for tux4life
0
259
Member Avatar for FyerEgg

It seems you have broke all good program design principles. As a result you have this incomprehensible and unstable code. 1. Why [i]input[/i], [i]i[/i] and [i]found[/i] variables are global ones?! You never use it outside the findwords function (and no need to use it in a such manner). 2. The …

Member Avatar for ArkM
0
152
Member Avatar for britto

[QUOTE=britto;811385]hi everyone..... how to create a c compiler using c language.... can anyone explain the steps involved..... thnx in advance[/QUOTE] Are you ready to study compiler generation ABCs (at least 0.5 year, ~1000 pages) then make a hard work for at least 2 years in 7/24 manner?

Member Avatar for MosaicFuneral
0
431
Member Avatar for colmcy1

>I'm not sure if C++ has this option What an option? The C++ has no any [i]options[/i]. It's a very powerful algorithmic language so you can invent any algorithm or data structure and implement it in C++ language. For example, your program case is a simplest array using example. What's …

Member Avatar for colmcy1
0
123
Member Avatar for cppnewb

This [i]secure C library[/i] stuff is in unstable state now so better don't waste a time with these *_s functions. They have the same functionality as old good standard functions. You will have troubles with 32-bit time values after 2038 year only so better forgive that _time64 and time_64_t names. …

Member Avatar for cppnewb
0
1K
Member Avatar for jitendra.theta

Prefix increment/decrement operators return lvalue (a reference to operator argument in C++ terms) so it's possible to increment/decrement this lvalue. Postfix increment/decrement operators return rvalue (a value as is, not a reference to) so it's impossible to increment this value (it's not a variable).

Member Avatar for siddhant3s
0
107
Member Avatar for arpeggio54

>the popular definition of copy-constructor is ... [icode]myType(myType&)[/icode] It's a very bad (and dangerous) copy constructor signature, never use it. Don't invent wheel: [code=c++] Class(const Class&); // That's all, folks! [/code]

Member Avatar for siddhant3s
0
123
Member Avatar for Lotus_2011

Do you know that 70! is a number with ~100 digits, 450! has more than 1000 digits and so on... Are you sure that anybody thirsts for reading these huge numbers printed on console?.. Apropos, what for [icode]string Number[/icode] was declared in Fact function?..

Member Avatar for siddhant3s
0
110
Member Avatar for gyagyus
Member Avatar for Deepak.G

From CINT FAQ: [quote]# I want to understand CINT source code and want to make modification CINT has many legacy code. Inside CINT is quite messy. I do not recommend looking into the source code unless you have desparate reason.[/quote] [url]http://root.cern.ch/viewvc/trunk/cint/FAQ.txt[/url] From ROOT/CINT page: [quote]CINT is written in C++ itself, …

Member Avatar for ArkM
0
225
Member Avatar for nirav bhatt

1. I agree with Freaky_Chris remarks 100%... 2. Qualify ios class name with std:: namespace prefix. I don't know why but as usually programmers don't believe that compiler diagnostic is the best source of the right solution ;)...

Member Avatar for ArkM
0
121
Member Avatar for Avaviel

Look again at this "make room" loop (why parentheses? ): [code=c++] for (int i = size; i <= cursor + 1; i--) element[i] = element[i-1]; [/code] Take a paper and a pencil... size = 1, cursor = 0: [code] 1st loop... i = 1; 1 <= 0+1 ... element[1] = …

Member Avatar for StuXYZ
0
84
Member Avatar for smithss

You can't synchronize parent and child threads execution with _beginthread starter. It's possible that the main thread deallocates an array before or after the child thread will use it. In any case you can use deallocated (by C++ RTL) heap memory with or without segmentation fault. So we can see …

Member Avatar for Salem
0
147
Member Avatar for FEARmike21

Some (correct ;)) modification of your original algorithm: [code=c++] char c, prevc = ' '; while (cin.get(c)) { if (prevc == ' ' && islower((unsigned char)c) c = toupper((unsigned char)c); cout.put(prevc=c); } [/code]

Member Avatar for siddhant3s
0
152
Member Avatar for lil_panda

The question is [b]Objective-C[/b] language. As far as I know, GNU Objective-C++ allows some mix of C++ and Object-C modules (I never used it). [url]http://en.wikipedia.org/wiki/Objective-C[/url] See also: [url]http://www.faqs.org/faqs/computer-lang/Objective-C/faq/[/url]

Member Avatar for ArkM
0
169
Member Avatar for arussell817

1. Use code tag properly: [noparse][code=c++] source(s) [/code][/noparse] It's too hard to answer you without line numbers in formatted (by code tag) source. 2. It's a very typical error. You define a constructor of the class addressEntry: [code=c++] addressEntry::addressEntry( string phoneIn, string birthIn, string emailIn, string pictIn); [/code] Therefore you …

Member Avatar for siddhant3s
0
450
Member Avatar for jeevsmyd

[code=c++] /* The English consonants are: b, c, d, f, g, h, j, k, l, m, n, p, q, r, s, t, v, w, x, y, z. The English vowels are: a, e, i, o, u. The letter y can also act as a vowel. http://members.fortunecity.com/leanora/engpinen.html */ /* Dependencies: #include …

Member Avatar for siddhant3s
0
370

The End.