2,384 Posted Topics
Re: The following header is deprected, instead try to use <iostream>[code]#include <iostream.h>[/code]You shouldn't have the equals sign here.[CODE]#define q = 3[/CODE]I have no idea what this is intended to do.[code]int n; if (n < 0) return 0;[/code]Again, your code it a little unclear here. It says to declare a variable [font=Courier … | |
Re: [QUOTE=Aia;304293]What upset me sometimes is that any book or video tutorial that tries to teach you C programming, all of them teach you to use gets() and scanf() as the default to read input. I understand that is easy for learning but it should be shown what problems you get … | |
Re: Extraneous: [url]http://predef.sourceforge.net/preos.html#sec24[/url] [url]http://predef.sourceforge.net/[/url] | |
| |
Re: [QUOTE=jbennet;386060]I also like metallica Black Album (its called metallica thats kinda its unofficial name)[/QUOTE]Any of the other older stuff? Gotta have 'Puppets. Trivia: the DJ got a kick out of playing "Metallica" for the "first dance of bride and groom" at my wedding -- it happened to be from the … | |
Re: Please stop using [url="http://www.research.att.com/%7Ebs/bs_faq2.html#void-main"]void main[/url]. | |
Re: A [url=http://groups.google.com/groups?q=prevent+inheritance+group:comp.lang.c%2B%2B]start[/url]? | |
Re: Was there a question there? Isn't your compiler telling you things that are wrong? | |
Re: [url]http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2[/url] | |
Re: Hmm... [url]http://jitcrunch.cafepress.com/jitcrunch.aspx?bG9hZD1ibGFuayxibGFuazo5MF9GLmpwZ3xsb2FkPUwwLGh0dHA6Ly9pbWFnZXMuY2FmZXByZXNzLmNvbS9pbWFnZS8xODkyNTcwN180MDB4NDAwLmpwZ3x8c2NhbGU9TDAsNDAwLDEyMCxXaGl0ZXxjb21wb3NlPWJsYW5rLEwwLEFkZCw0MCwxODB8bG9hZD1tYXNrLGJsYW5rOjkwX0ZfbWFzay5qcGd8Y29tcG9zZT1ibGFuayxtYXNrLE1hc2ssMCwwfGNwPXJlc3VsdCxibGFua3xzY2FsZT1yZXN1bHQsMCw0ODAsV2hpdGV8Y29tcHJlc3Npb249OTV8[/url] ? | |
Re: Not a favorite, but [QUOTE="Nikita Kruschev"]We cannot expect the American people to jump from Capitalism to Communism, but we can assist their elected leaders in giving them small doses of Socialism until they awaken one day to find they have Communism. [/QUOTE] | |
Re: I've done that one before. It's rather cool. [url]http://www.grand-illusions.com/images/articles/opticalillusions/three_dragons/three_dragons.wmv[/url] | |
Re: [QUOTE=chound]Is it possible to create programmes to run on coumputers thad do not have any operating systems? :evil: :cheesy: :sad:[/QUOTE]That's generally what I do, so yes. | |
Re: Call [FONT=Courier New]srand[/FONT] once in a program, before the loop. | |
Re: >WHY am I allowed to do this??????? You are not [i]allowed[/i] to do this. Undefined behavior is, well, undefined behavior. It could behave how you think is "correct", it could crash, it could something completely different. Now I'll admit, if all undefined behavior required something hideously harsh like reformatting your … | |
Re: [QUOTE=lara_]i dunno whether this question has been ask before but i've try to search but didn't found. so i ask it here... very simple... if i declare [b]int Z; cin >> Z;[/b] if I enter integer, it works fine but i enter character it's looping. :sad:[/QUOTE] If you enter characters … | |
Re: char *filein,*fileout,ch; scanf("%s",filein); Yikes! | |
Re: A search for [I]Fibonacci[/I] here or with Google ought to give you enough to start with, if not something to finish with. | |
Re: This is assignment. (The subsequent comparison is always true.)[code]if (input = 1)[/code]This is comparison.[code]if (input =[COLOR=Blue]=[/COLOR] 1)[/code]Ever here the phrase, "What happens in Vegas stays in Vegas" (or something similar)? Well, function are like that too. Whatever happens to a local variable inside a function is lost on the outside … | |
Re: Use fewer iterations of the loop? | |
Very early on when attempting to learn programming in C, you often do exercises that read in and print out strings and numbers. Now you might assume that C has a simple function that will get user input, and indeed it does, but there are a couple of gotchas that … | |
Re: [CODE]void foo(int a[6][6]) { int i, swap[6]; for (i = 0; i < 3; ++i) { memcpy(swap, a[i], sizeof swap); memcpy(a[i], a[5 - i], sizeof swap); memcpy(a[5 - i], swap, sizeof swap); } }[/CODE] | |
Re: [QUOTE=hbk619;424917]Just because I don't want to get married it means I can't love somone? Sheesh.[/QUOTE]An alternate take about shacking up is that you ain't got the stones to publicly state to all your family and friends that "this is it". That's one view of the ceremony. Another view is similar … | |
Re: [QUOTE=Nicanor]Trying to compile a program, in my accounts.cpp I have 2 errorsp[quote]accounts.cpp:240: error: name lookup of `a' changed for new ISO `for' scoping accounts.cpp:234: error: using obsolete binding at `a'[/quote]here's the code [code]bool cAccount::IsOnline( int acctnum ) { if (acctnum < 0) return false; map<int, acctman_st>::iterator iter_acctman; if ((iter_acctman = … | |
Re: My name is Johnny and I'm a: [list][*]Politics/opinion/news geek [*]Nouveau blogging geek [*]Embedded systems geek[/list] | |
Re: [QUOTE=christina>you;429278]So most say that dictatorship is more efficient than democracy...[/QUOTE]Your questions seem like a homework assignment. For that I would refer you to Wikipedia, generally. If you care to be digging deeper, present a more focused question. (I claim a pass because I have presented a history of doing such … | |
Re: [url]http://eternallyconfuzzled.com/tuts/bst1.html#insert[/url] | |
Re: [code][color=darkgreen][b]#include[/b][/color] <stdio.h> [color=blue][b]void[/b][/color] [b][color=red]foo[/color][/b]([b][color=blue]int[/color][/b] n) { [b][color=blue]if[/color][/b] ( n >= [color=teal]0[/color] ) { [b][color=red]printf[/color][/b]([color=teal]"%d "[/color], n); [b][color=red]foo[/color][/b](n - [color=teal]1[/color]); } } [b][color=blue]void[/color] [color=red]bar[/color][/b]([b][color=blue]int[/color][/b] n) { [b][color=blue]if[/color][/b] ( n >= [color=teal]0[/color] ) { [b][color=red]bar[/color][/b](n - [color=teal]1[/color]); [b][color=red]printf[/color][/b]([color=teal]"%d "[/color], n); } } [b][color=blue]int[/color] [color=red]main[/color][/b]() { [b][color=blue]int[/color][/b] value = [color=teal]5[/color]; [b][color=red]foo[/color][/b](value); [b][color=red]putchar[/color][/b]([color=teal]'\n'[/color]); [b][color=red]bar[/color][/b](value); … | |
Re: An obligatory link to [url]http://c-faq.com/malloc/calloc.html[/url] | |
Re: Possibly...?[code]typedef struct GROUP GROUP; [COLOR="Red"]/* assuming * was erroneous? */[/COLOR] typedef struct CHUNK CHUNK; [COLOR="Red"]/* assuming * was erroneous? */[/COLOR] [COLOR="Red"]typedef enum {false,true} bool;[/COLOR][/code] | |
Re: Define this constructor. [code]Dictionary(int word = 1);[/code] | |
Re: A search engine is usually a better place to start with such questions. [url]http://en.wikipedia.org/wiki/Design_pattern_(computer_science)[/url] [url]http://en.wikipedia.org/wiki/Design_Patterns[/url] | |
Re: [QUOTE=patito]hi crazydieter, i had a problem compiling the code again: C:/MINGW/BIN/../lib/gcc-lib/mingw32/3.2.2/../../../libstdc++.a(c++locale.o)(.tex t+0x3a0): undefined reference to `strtold'[/QUOTE] Maybe use [FONT=Courier New]strtod[/FONT] instead of [FONT=Courier New]strto[COLOR=Red]l[/COLOR]d[/FONT] and be sure to [FONT=Courier New]#include <cstdlib>[/FONT]. [QUOTE=patito]can you please mail me the binary? << moderator edit: removed email address >> thanks![/QUOTE]Please post questions and replies … | |
Re: As it's a compile error, I might suspect that gcc has not been made aware of the include path. | |
Re: Doesn't [font=Courier New]new[/font] throw an execption instead of returning [font=Courier New]NULL[/font] unless you explicitly use '[font=Courier New]new(std::nothrow)[/font]'? | |
Re: [QUOTE=iamboredguy]I don't get why C++ pros see red when they see [b]void[/b] main(). Can someone explain why [b]int[/b]main() is good and [b]void[/b] main() bad?[/QUOTE]In [url="http://www.daniweb.com/techtalkforums/showthread.php?p=46872&highlight=void+main+wrong#post46872"]this reply[/url], I posted 6 links to explanations of why it is considered wrong. | |
Re: There is a bug in the code. You are fortunate that the UNIX platform at least shows you this; in Windows it is just "lucky" to be running. | |
Re: [url=http://www.open-std.org/jtc1/sc22/wg14/www/docs/n897.pdf]Rationale[/url]:[quote]7.19.7.7 The gets function Because gets does not check for buffer overrun, it is generally unsafe to use when its input is not under the programmer’s control. This has caused some to question whether it should appear in the Standard at all. The Committee decided that gets was useful and … | |
Re: Poor indentation strikes again! The function [FONT=Courier New]battle()[/FONT] appears to be missing a closing [FONT=Courier New]}[/FONT]. | |
Re: The Turbo C I am most familiar with was designed to be used under DOS: preceding Windows 3.1, preceding Win95, preceding Win98, preceding Win2000, preceding WinXP. The huge hint to be taken here is that it is generally not appropriate for general use on a more modern OS, and this … | |
Re: A [url=http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046380353&id=1044780608]start[/url]. | |
Re: [QUOTE=boyhenyo;448877]hi please help me....can you give me a code for queue program???[/QUOTE][URL="http://www.daniweb.com/forums/announcement8-2.html"]No[/URL]. | |
Re: [quote=Rob Pike]Rule 5. Data dominates. If you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming.[/quote]Have you begun to set up a data type? (And you may want to mention the language -- C or … | |
Re: How about writing each question as a function. Have the function return 0 if they get it wrong or 1 if they get it right. Loop around each question-function until they get it right, then move to the next function-question. | |
Re: [url]http://www.parashift.com/c++-faq-lite/private-inheritance.html[/url] | |
Re: [QUOTE=Nathan Campos;966424]As you can see in my previous posts i was trying to correct the only code snippet that i've founded in Google, but it's getting so much errors.[/QUOTE]I was able to build with no errors the code you posted. My IDE hides the feeding of the linker, but I … | |
Re: Loop through all array elements and compare each element; if all elements are the same, consider the arrays equal. Or use [url="http://www.rt.com/man/memcmp.3.html"][font=Courier New]memcmp[/font][/url], which essentially does this. | |
This code uses a structure to map a letter to an equivalent representation of Morse code. It simply loops through either a string to encode or decode looking for text to substitute with a replacement string or character. Output is presented to the stdout. |
The End.