6,741 Posted Topics

Member Avatar for Aman6o

[QUOTE]Please advise.[/QUOTE] You're compiling as C++. Compile as C instead and the error will go away, but the code is still slightly off in terms of modern correctness. This is more correct: [code] #include <stdio.h> /* Full prototype (file scope is conventional) */ int add_two_numbers(int a, int b); /* Full …

Member Avatar for Aman6o
0
2K
Member Avatar for Jiggle

The differences between languages of the same ancestry (C++ and Pascal are both Algol derivatives) are more syntax than anything, and those differences are easy to figure out. Further, knowing C++ will help you even if you ultimately never use it, so continuing that education is certainly reasonable. But you …

Member Avatar for Jiggle
0
86
Member Avatar for NetJunkie

[QUOTE]Why would absolute beginner, that does not know how to use rand(), use vectors?[/QUOTE] What's wrong with vectors? I assume you're suggesting that arrays be used instead, which is silly. C++ doesn't [I]have[/I] to be learned from the bottom up. In fact, learning C++ with an eye toward realistic code …

Member Avatar for mrnutty
0
200
Member Avatar for Coffee_Table

[QUOTE]Now, an affecting factor is that there may be anywhere from no strings with the same length in the vector up to all strings having the same length.[/QUOTE] Obviously the best case for comparison is where no strings have the same length, in which case the comparison is O(1) because …

Member Avatar for Narue
0
614
Member Avatar for Mz. Jackee

And? What have you done so far? Realize that Daniweb isn't a homework service, we expect you to put forth a certain measure of effort.

Member Avatar for Netcode
0
122
Member Avatar for Dani

Maybe I can get my iOS developer friends to hang out on Daniweb now. ;)

Member Avatar for Netcode
0
167
Member Avatar for Rizi004
Member Avatar for valestrom

I see no headers included. Presumably you've been relying on the precompiled header stdafx.h that Visual C++ likes to put into projects?

Member Avatar for Fbody
0
205
Member Avatar for nuliknol

Appendix C is what you want from [URL="http://www.intel.com/content/dam/doc/manual/64-ia-32-architectures-optimization-manual.pdf"]this manual[/URL]. However, note that due to differences in processors and the myriad optimizations (multi-core, pipelining, etc...), pinning down reasonably exact counts in real code is very difficult without extensive profiling.

Member Avatar for nuliknol
0
101
Member Avatar for pravin_bug

That's a pretty evil looking expression. Here's a hint: the two trailing -'s combine to form a postfix decrement operator while the two leading -'s are separate unary operators.

Member Avatar for pravin_bug
0
71
Member Avatar for srednakun

dayDifference() returns an int value in all cases. Since you didn't specify what that value is, it's garbage.

Member Avatar for pavangajula2007
0
236
Member Avatar for Mahkoe

[QUOTE]Right now I have a snippet of code that makes logical sense but in fact doesn't work[/QUOTE] Actually, that snippet makes no sense at all. If you're looking to write a bigint library, then your best bet would be to find a simple one and study the code. A good …

Member Avatar for Mahkoe
0
186
Member Avatar for clyo cleopas

The string class is in namespace std too. In fact, every standard name is in the std namespace.

Member Avatar for Schol-R-LEA
0
97
Member Avatar for Onlineshade

On a side note, code tags are pointless if your code has no formatting. Please indent your code.

Member Avatar for Narue
0
137
Member Avatar for theguitarist

[QUOTE]But what happened to operator precedence?[/QUOTE] Your parentheses aren't changing anything, the precedence of [ICODE](i=15)||(j=26)[/ICODE] is identical to [ICODE]i=15||j=26[/ICODE]. Short circuiting rules here, so if [ICODE]i=15[/ICODE] evaluates to true, the latter half of the expression is skipped.

Member Avatar for theguitarist
0
143
Member Avatar for ravanan

[QUOTE]can anyone explain me how to use the inline function in c++ code with example?[/QUOTE] There are two ways, actually. The inline keyword is one: [code] // foo is explicitly inline inline void foo() { /* ... */ } [/code] Another is for member functions defined inside of a class: …

Member Avatar for tajendra
0
382
Member Avatar for c++creator

[QUOTE=c++creator;1638381]Thanks Saith and Cross213,though what does Cross213 mean by?[/QUOTE] He means (I hope) that the prototype introduces enough information about a function to safely call it without requiring the function's definition to be visible.

Member Avatar for frogboy77
0
567
Member Avatar for Onlineshade

[QUOTE]And you can't say cin >> k without asking for it to be entered.[/QUOTE] This is false. Just because there's no prompt doesn't mean the program isn't waiting for input. [QUOTE]I've tried compiling your program and it just gives a blank screen so that should mean something. [/QUOTE] It means …

Member Avatar for raptr_dflo
0
53
Member Avatar for DJWK

[QUOTE]I thought it was mandatory because the examples in the book are done this way.[/QUOTE] You should probably get a newer book. In the example from your first post, removeEntry() [i]is[/i] declared prior to main(). A function definition also acts as a declaration.

Member Avatar for Adak
0
147
Member Avatar for Onlineshade

There are a number of graphics libraries available depending on your needs. Can you be more specific?

Member Avatar for m4ster_r0shi
0
165
Member Avatar for kylelendo

That sounds like the focus of your windows is changing. Is Ctrl+F9 running the debugger? What IDE are you using?

Member Avatar for Narue
-1
233
Member Avatar for emreozpalamutcu

Look for details on the System::Net::Mail::SmtpClient class. It's dead easy to send email with .NET.

Member Avatar for cent91
0
607
Member Avatar for Dani

[QUOTE]You can thank global warming for all but the earthquake.[/QUOTE] That's a lie! Global warming is responsible for earthquakes too. Along with (but not exclusive to) excessive cold weather, blizzards, ice storms, volcanos, meteors, tsunami, AIDS, cancer, Alzheimer's, the common cold, homosexuality, missing socks, spelling errors, Barack Obama, fizz overflow …

Member Avatar for Dani
0
112
Member Avatar for aspirewire
Member Avatar for IndianaRonaldo

A forum on the C++ language isn't likely to be informative either. You'd have more luck on a forum that specializes in CURL.

Member Avatar for IndianaRonaldo
0
188
Member Avatar for shrutipopat

Yea, that's quite enough. Stupid abbreviations are annoying enough, but they're also against our rules: "Do post in full-sentence English" "Do not write in all uppercase or use "leet", "txt" or "chatroom" speak" Thread closed. Please collect your thoughts and compose a coherent question before posting again. kthxbye.

Member Avatar for Narue
0
99
Member Avatar for sirknieghf

sirknieghf, you need to learn how local variables work: [code] void foo() { info customer; // An info object is created customer.price = 123; // The info object is modified } // The info object is destroyed [/code] All of your functions are treating the customer object as if it's …

Member Avatar for sirknieghf
0
392
Member Avatar for yash_shukla

I don't think you're ready for pointers and strings just yet. You still don't have a handle on variables. Please take a step back and take a little more time on simpler programs. But since I don't want this post to be completely negative, here's correct code for your program …

Member Avatar for Onlineshade
0
121
Member Avatar for amrita111

[QUOTE=Adak;1630037]printf returns the number of chars printed, and you didn't print any objects, so it would return a negative number, as an error IF your compiler allowed it to compile.[/QUOTE] printf() only returns a negative value if there's an "output or encoding error". Since printf()'s internal loop is essentially skipped …

Member Avatar for Narue
0
219
Member Avatar for MrAppleseed

[QUOTE]Too late, already made char array tokens[/QUOTE] It's never too late to refactor your code into something better.

Member Avatar for Narue
0
134
Member Avatar for c++creator

Your pause at the end isn't really pausing because there's extraneous characters in the stream. Specifically, when reading an integer, the [noparse][Enter][/noparse] key you pressed will remain in the stream for [ICODE]cin.get()[/ICODE] to read later. You'll find that if you call [ICODE]cin.get()[/ICODE] a second time, it'll work as intended, which …

Member Avatar for c++creator
0
181
Member Avatar for fullarmorzz

[QUOTE]why removed the & sign in the name?[/QUOTE] The following is a common oversimplification: "Always use & on variables in scanf()". While the intention is fine--don't confuse beginners by introducing pointers too soon--but the simplification is likely to cause just as much confusion. The reality is that because scanf() writes …

Member Avatar for Onlineshade
0
123
Member Avatar for shanki himanshu

[QUOTE=shanki himanshu;1637804]recursion is calling a function itself and in a function we have set of statements. does this means it is iteration??[/QUOTE] Do you think it's a basic question [I]now[/I]? Muahahahaha!!! :D Let's make it simple: [B]Iteration[/B] is an [i]explicit loop[/i] using one of C's loop constructs (for, while, do..while[1]). …

Member Avatar for sharathg.satya
0
136
Member Avatar for Javaid1

[QUOTE]What is the difference between "G1" and "G1 "[/QUOTE] A space at the end...

Member Avatar for raptr_dflo
0
114
Member Avatar for ibthevivin

[QUOTE]Actually my compiler ( Dev c++) do not support code without conio.h , getch().[/QUOTE] Unless you typed "without" while meaning "with", that's total bullshit. If you did mean "with", it's still incorrect because Dev-C++ does support conio.h to a small extent, though [URL="http://www.bloodshed.net/dev/faq.html#conio"]a little tweaking[/URL] is required.

Member Avatar for Narue
0
295
Member Avatar for Ich bin würdig

What have you tried? We're not going to give anything away unless you put forth some effort first.

Member Avatar for Adak
0
231
Member Avatar for luciolon

The error is coming from your linker. This suggests that double_linked.cpp isn't being linked to main.cpp. How are you compiling this, and what does your main.cpp look like?

Member Avatar for luciolon
0
270
Member Avatar for anirudh33

[QUOTE]Q1. What is your name and job profile (like Database Administrator, Programmer etc.)?[/QUOTE] List me as anonymous. My job profile is software architect (enclosing all parts of development from requirements gathering to deployment and maintenance). I also act as a consultant for IT and development staff in a wide range …

Member Avatar for anirudh33
0
250
Member Avatar for Bench

[QUOTE]the point of linked lists is to make swapping elements efficient[/QUOTE] Any linked data structure has that benefit, but it's not the point of linked lists[1]. I'd argue that the point of a linked list is the principle benefit, which would be efficient growth (ie. insertion and deletion) in the …

Member Avatar for Narue
0
3K
Member Avatar for theju112

[QUOTE]WHY IS THE VALUE OF THE VARIABLE first getting modified??[/QUOTE] You have too many variables named [ICODE]first[/ICODE], and it's confusing you. In particular, you have a global [ICODE]first[/ICODE] and a local [ICODE]first[/ICODE] which hides the global one. Compare and contrast with my version of your program: [code] #include <stdio.h> #include …

Member Avatar for Narue
0
120
Member Avatar for jigglymig

[URL="http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]Clicky[/URL].

Member Avatar for jigglymig
0
108
Member Avatar for fullarmorzz

[QUOTE]In c++ we use <iostram.h> but not in c.[/QUOTE] [i]You[/i] might, but since many modern compilers fail to accept <iostream.h> at all, a lot of us prefer the standard <iostream>. [QUOTE]C++ reduces the length of code by using object.[/QUOTE] Reduced code size isn't one of the advantages of OOP in …

Member Avatar for Onlineshade
0
132
Member Avatar for goluman

It looks like you have a vector of pairs, which is slightly harder to use with std::accumulate() because you need a custom function or function object to handle the summation: [code] #include <algorithm> #include <iostream> #include <utility> #include <string> #include <vector> struct sum_second { template <typename T, typename U> U …

Member Avatar for Narue
0
179
Member Avatar for rajatchak

[QUOTE]IS THERE ANY WAY FOR THE USER TO ENTER "ENTER" TO FINISH TYPING....[/QUOTE] Since you're using getche() to read characters, your loop needs to recognize the first part of a newline. Since you're using Windows, that character would be the first part of a CRLF sequence: '\r'. [code] #include <iostream> …

Member Avatar for rajatchak
0
1K
Member Avatar for now how abt tht

[QUOTE]the point is the code that I posted gives an error why?[/QUOTE] Because your code is wrong. [QUOTE]and somtimes the other exp gives an error...[/QUOTE] Because your code is wrong. [QUOTE]is it compiler dependent?[/QUOTE] No, your code is just wrong. Read [url=http://pw1.netcom.com/~tjensen/ptr/pointers.htm]this[/url] and [url=http://eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx]this[/url].

Member Avatar for jnawrocki
0
134
Member Avatar for D33wakar

[QUOTE]While the second method using fprintf() seems to work.[/QUOTE] fprintf() and fwrite() do completely different things. fprintf() converts values into their textual representation while fwrite() just dumps the bytes of the value to a stream without any kind of conversion. Your garbage is perfectly understandable as the contents of the …

Member Avatar for Narue
0
113
Member Avatar for David321

[QUOTE]I was there right now, and there were only a couple of ops in other than me. Very very quiet.[/QUOTE] Because a weekday morning should be hopping. ;)

Member Avatar for ~s.o.s~
0
168
Member Avatar for Arjun_Sarankulu

[QUOTE]Search a lot but didnt got the same[/QUOTE] Very rarely will you find a solution to your exact problem. Since you haven't done any threaded development thus far, I'd recommend a [URL="http://www.codeproject.com/KB/threads/ThreadingDotNet.aspx"]general threading tutorial[/URL] first, then something [URL="http://www.codeproject.com/KB/threads/StepByStepThreads.aspx"]specific to your current problem[/URL] of updating the UI with progressive results from …

Member Avatar for Narue
0
158
Member Avatar for David321

I'm not a fan of the Deitel series, but you'd be wise to get the newest edition (8th edition, at the time of this post). It'll contain error corrections from the other editions as well as reasonably up-to-date content. Though every time I check, the Deitel books are hideously overpriced. …

Member Avatar for David321
0
119
Member Avatar for Anuradha Mandal

Those requirements are odd. Given the ranges of [ICODE]ti[/ICODE] and [ICODE]k[/ICODE], I would expect to check if [ICODE]ti[/ICODE] evenly divides [ICODE]k[/ICODE], not if [ICODE]ti[/ICODE] is divisible by [ICODE]k[/ICODE]. Any [ICODE]k[/ICODE] larger than 109 in the latter case is completely predictable and need not be checked.

Member Avatar for Narue
0
89

The End.