- Strength to Increase Rep
- +18
- Strength to Decrease Rep
- -4
- Upvotes Received
- 571
- Posts with Upvotes
- 421
- Upvoting Members
- 170
- Downvotes Received
- 52
- Posts with Downvotes
- 33
- Downvoting Members
- 37
2,384 Posted Topics
Re: [URL="http://www.minerals.net/mineral/oxides/corundum/corundum.htm"]Corundum[/URL]? | |
Re: [inlinecode]getchar[/inlinecode] This is a standard function that gets a character from the stdin. [inlinecode]getch[/inlinecode] This is a nonstandard function that gets a character from keyboard, does not echo to screen. [inlinecode]getche[/inlinecode] This is a nonstandard function that gets a character from the keyboard, echoes to screen. Use [inlinecode]getchar[/inlinecode] if you … | |
Re: C and C++ do not have built-in standard support for sound. You will need to mention your compiler and OS and look into sound libraries. | |
Re: [QUOTE=happygeek;594777]There is no option to delete an account because doing so, and removing postings associated with that deleted account, would create huge holes in the DaniWeb database - support threads would become meaningless. You can, however, unsubscribe to admin emails and posting notifications etc via the control panel, and then … | |
Re: [QUOTE=DemonLady]I got this assignment and I'm stuck. I have to write a function that takes an integer value and returns the number with its digits reversed. For example, given the number 7631, the function should return 1367. Can someone help? :confused:[/QUOTE]This question gets asked about once a week on a … | |
Re: In addition to the declaration issues jesseb07 pointed out, I think you've still got indexing issues with the [ICODE]m[/ICODE] and [ICODE]n[/ICODE] loops that also increment [ICODE]a[/ICODE] and [ICODE]b[/ICODE]. [edit]Maybe reset [ICODE]b[/ICODE]? [code] a = i-1; for ( m = 0; m < 3; m++, a++ ) { [COLOR="Red"]b = j-1;[/COLOR] … | |
Re: Hint: [url]http://www.play-hookey.com/digital/adder.html[/url] | |
Many times [inlinecode]strtok[/inlinecode] is recommended for parsing a string; I don't care for [inlinecode]strtok[/inlinecode]. Why? [list][*]It modifies the incoming string, so it cannot be used with string literals or other constant strings. [*]The identity of the delimiting character is lost. [*]It uses a static buffer while parsing, so it's not … | |
With regard to C++ books, I'll just echo the advice here .The following books are recommended; read them in mostly the order listed." Accelerated C++ " Andrew Koenig & Barbara Moo " The C++ Standard Library " Nicolai Josuttis --- a "must have" " Effective C++ ", " More Effective … | |
Re: Some links I've had lying around (I haven't visited some of these in quite some time -- take note): [B]Tutorials[/B]:[list][*][url=http://cprog.tomsweb.net/cintro.html]An introduction to C[/url] [*][url=http://www.its.strath.ac.uk/courses/c/]C Programming[/url] [*][url=http://www.cs.cf.ac.uk/Dave/C/]Programming in C - UNIX System Calls and Subroutines using C[/url][/list] [B]References[/B]:[list][*][url=http://www.weycrest.co.uk/information/infosec/info/programming/C_Ref_Card.pdf]C Reference Card (ANSI)[/url] [*][url=http://www-ccs.ucsd.edu/c/]Standard C[/url] [*][url=http://www.swansontec.com/sopc.htm]C Language Operator Precedence Chart[/url] [*][url=http://www.acm.uiuc.edu/webmonkeys/book/c_guide/]The C Library … | |
Re: Issues when building with mingw: [QUOTE][COLOR="Red"]main.cpp:12: error: ISO C++ prohibits anonymous structs[/COLOR] main.cpp: In function `void onFrame(pixel*)': main.cpp:60: error: expected primary-expression before "unsigned" main.cpp:60: error: expected `;' before "unsigned" main.cpp: In function `void MakeSurface(HWND__*)': main.cpp:134: warning: passing NULL used for non-pointer converting 2 of `void* CreateThread(_SECURITY_ATTRIBUTES*, DWORD, DWORD (*)(void*), void*, … | |
Re: [QUOTE=AJones;245832]It just does not read iostream.h file.[/QUOTE]*Ahem* Don't [INLINECODE]#include <iostream[COLOR="Magenta"].h[/COLOR]>[/INLINECODE]. Do [INLINECODE]#include <iostream>[/INLINECODE], and you then should be [INLINECODE]using namespace std;[/INLINECODE]. I believe this was mentioned already. Post [U]exactly[/U] the code you are using -- subtle typos CAN make a difference. | |
Re: Is C:\Dev-Cpp\bin in your path?[quote]C:\Test\GnuC>path PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C;\icc\bin;[COLOR=Blue]C:\Dev-Cpp\bin[/COLOR];C:\BC5\BIN;C:\watcom\BINNT;C:\watcom\BINW;c:\Perl\bin;C:\Program Files\ActiveState Komodo 3.1\;C:\Program Files\Common Files\GTK\2.0\bin;C:\Program Files\Common Files\Autodesk Shared\;C:\Program Files\Autodesk\DWG TrueView\;..\tool;C:\Program Files\doxygen\bin;C:\Program Files\Subversion\bin;C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\Microsoft Visual Studio\Common\IDE\IDE98;C:\Program Files\vslick\win;C:\NECTOOLS\BIN;..\tool;C:\COSMIC\EVAL08;c:\nectools32\bin; [/quote] | |
Re: [QUOTE=makan007;1116352]I want count the elements in a srand generated array.[/QUOTE] For me, the basic premise is lacking. You don't need to count the members of an array because you know how many elements it has when you declare it. Or if it is dynamic, you know how many elements when … | |
Re: :)[QUOTE="Ronald Reagan"]Politics I supposed to be the second-oldest profession. I have come to realize that it bears a very close resemblance to the first.[/QUOTE] | |
Re: [QUOTE=gerard4143;1105029]Try something like below:[/QUOTE] With the MinGW version of gcc: [QUOTE]main.c main.c: In function `main': main.c:18: warning: implicit declaration of function `getline' Linking... Debug/main.o: In function `main': C:/Users/Dave/Projects/scratch/main.c:18: undefined reference to `_getline' collect2: ld returned 1 exit status *** Errors occurred during this build *** [/QUOTE] [QUOTE=taverasme;1104994]I need to write … | |
Re: [QUOTE=Asif_NSU]i would really love to know if there's any other way to get the functionality of getch()(i.e without using getch()) in the above mentioned cases.[/QUOTE]The problem with unbuffered input is that it becomes the responsibility of the programmer to handle the buffering. Do you allow the user to make a … | |
Re: This is a [URL="http://c-faq.com/stdio/stdinflush.html"]no-no[/URL]: [code]fflush(stdin);[/code] And scanf with [ICODE]%s[/ICODE] could be done better or [URL="http://c-faq.com/stdio/scanfprobs.html"]avoided[/URL]. [CODE]scanf("%s",person->name);[/CODE] [url]http://www.daniweb.com/tutorials/tutorial45806.html[/url] | |
Re: Wonderful! Be a pompous ass and dredge up an old thread (after reiterating the same demand a 3rd time), offering nothing, and pretend you are being courteous! Well, done. *plonk* | |
Re: They're found in the source code of a language implementation. That is, Borland C/C++, Microsoft Visual C++, Dev-C++, gnu, etc. (And the implementation of the C or C++ language may itself not be in C or C++.) What you get when you use C or C++ is a defined interface … | |
Re: > #include<stdio.h> > int main () > { > [COLOR="Red"]char x; [/COLOR] > printf("\nEnter a Character : "); > [COLOR="Red"]x = getchar();[/COLOR] > printf("\nThe ASCII for Char is: %d",x); > return 0;/*** was avoiding this line ****/ > } Since `getchar` returns an `int`, `x` should be an `int`. This … | |
Finding some text and replacing it with new text within a C string can be a little trickier than expected. Here is what I had come up with one day. | |
Re: I thought that one was: "Thou shalt not comfort thy rod with thy staff." | |
| |
Re: I looked into it when one of my radio talk show host got on the topic a while back. I have a new date to be interested in. I'm looking forward to subsequent shows on TV and radio. | |
Re: This is one way. [CODE] [color=darkgreen][b]#include[/b][/color] <iostream> [color=darkgreen][b]#include[/b][/color] <ctime> [b][color=blue]int[/color][/b] [b][color=red]main[/color][/b]() { [b][color=blue] struct[/color][/b] [color=#4b0082]std[/color]::[color=indigo]tm[/color] a = {[color=teal]0[/color],[color=teal]0[/color],[color=teal]0[/color],[color=teal]24[/color],[color=teal]5[/color],[color=teal]104[/color]}; [color=orange]/* June 24, 2004 */[/color] [b][color=blue] struct[/color][/b] [color=#4b0082]std[/color]::[color=indigo]tm[/color] b = {[color=teal]0[/color],[color=teal]0[/color],[color=teal]0[/color],[color=teal]5[/color],[color=teal]6[/color],[color=teal]104[/color]}; [color=orange]/* July 5, 2004 */[/color] [color=#4b0082] std[/color]::[color=indigo]time_t[/color] x = [color=#4b0082]std[/color]::[b][color=red]mktime[/color][/b](&a); [color=#4b0082] std[/color]::[color=indigo]time_t[/color] y = [color=#4b0082]std[/color]::[b][color=red]mktime[/color][/b](&b); [b][color=blue] if [/color][/b]( x != ([color=#4b0082]std[/color]::[color=indigo]time_t[/color])([color=teal]-1[/color]) … | |
Re: I can't see your computer, but it sounds like you have a missing source file in your project list. [URL=http://img140.exs.cx/my.php?loc=img140&image=devc3ft.gif][IMG]http://img140.exs.cx/img140/3929/devc3ft.th.gif[/IMG][/URL] You may need to add the file containing the definition the linker needs. [URL=http://img140.exs.cx/my.php?loc=img140&image=devc29xk.gif][IMG]http://img140.exs.cx/img140/7249/devc29xk.th.gif[/IMG][/URL] [quote=Asif_NSU]I just had a glance at how to write makefiles. Looks messy[/quote]Yeah, makefiles are their own … | |
Re: Did you save it or did it automatically save after entering the 3 lines? [And next time, try to put your code between CODE tags] | |
Re: [url]http://www.compilers.net/Dir/Free/Compilers/CCpp.htm[/url] | |
Re: [QUOTE=Stack Overflow]This process is not hard since the default libraries included a function to do this. It's called itoa().[/QUOTE]And [font=Courier New]itoa[/font] is nonstandard. A standard function is [font=Courier New]sprintf[/font].[code]#include <stdio.h> int main(void) { const char base[] = "filename"; char filename [ FILENAME_MAX ]; int number = 42; [color=Blue]sprintf(filename, "%s%d", base, … | |
Re: Do cin.get() twice. Read the FAQs and stickies for more info. | |
Re: [QUOTE=C++]I think the answer is: void divide(int numerator,int denominator,int* quotient, int* remainder){ *(quotient=[color=Red]&[/color]numerator/[color=Red]&[/color]denominator); *(remainder=[color=Red]&[/color]denominator%[color=Red]&[/color]numerator); }[/QUOTE]Divide [i]values[/i], not [i]memory locations[/i]:[code]#include <stdio.h> void divide(int numerator, int denominator, int* quotient, int* remainder) { *quotient = numerator / denominator; *remainder = denominator % numerator; } int main(void) { int numerator=42, denominator=5, quotient, remainder; divide(numerator,denominator,"ient,&remainder); … | |
Re: Here's a better idea for the return value: return an explicit value instead of allowing the possibility of signed integer overflow? | |
Re: I find the diagnostic message quite self-explanitory.[quote]declaration of `c' as multidimensional array must have bounds for all dimensions except the first[/quote]You can't do [FONT=Courier New][][][/FONT]. You can do [FONT=Courier New][][5][/FONT], for example. | |
Re: test.c 11 error [Warning 603] Symbol 'bin' (line 8) not initialized test.c 14 error [Warning 534] Ignoring return value of function 'gets(char *)' test.c 14 error [Warning 421] Caution -- function 'gets(char *)' is considered dangerous test.c 17 error [Info 725] Expected positive indentation from line 16 test.c 19 error … | |
While not terribly difficult, first timers may not know the functions to look up and use. Here is some basic code for reading a file one line at a time. The contents of the file are printed to the stdout. | |
Re: Post the code you have so far -- remember to use code tags. | |
Re: Have you ever heard of "debugging with printf"? A similar thing can be done with cout as well. You pepper this code with statements that display for you any items of interest while the program is running. It's a good way to see for yourself what is going on in … | |
Re: An array of size N will be indexed from 0 to N-1. The standard idiomatic for loop is then like this: [CODE]for ( int i = [color=Blue]0[/color]; i [color=Blue]<[/color] N; ++i )[/CODE] | |
Re: Not necessarily. You could just remove this line and run the program from a command shell. Or use a standard method of pausing such as [FONT=Courier New]cin.get[/FONT]. ![]() | |
Re: [QUOTE=cscgal]iamthwee, DaniWeb actually has built-in Tex functionality by using the tex bbcode. There is no need to hotlink tex from an image upload service [tex]iamthwee=x^2[/tex][/QUOTE]Does it work for you? It doesn't appear to work for me. [tex]y=x^2[/tex] [quote][Unparseable or potentially dangerous latex formula. Error 4 ][/quote] | |
Re: I'd just read all lines of the file into a circular buffer with 10 strings, each containing a line. When you get to the end of the file, you will have the last 10 lines stored. [code]#include <iostream> using std::cout; #include <fstream> using std::ifstream; #include <string> using std::string; using std::getline; … | |
Re: Related: [url]http://c-faq.com/osdep/filesize.html[/url] | |
Re: You may want to try [font=Courier New]fgets[/font]/[font=Courier New]sscanf[/font]. Maybe something like this.[code]#include <stdio.h> int main(void) { const char filename[] = "file.txt"; FILE *file = fopen(filename, "r"); if ( file ) { char line [ BUFSIZ ]; while ( fgets(line, sizeof line, file) ) { char substr[32], *ptr = line; int … | |
Re: [URL="http://www.outsidethebeltway.com/archives/posse_comitatus_its_a_stupid_law_anyways/"]Posse Comitatus? Its a Stupid Law Anyways[/URL] | |
Re: It's not a syntax issue, since it compile; it is a runtime issue in which you allow your code to do something it is not supposed to do. In particular it happens to indicate that the issue involves something you may have attempted to do involving floating point. Without posting … | |
Re: Try it with a dynamic array and find out you are wrong. You are being helpfully corrected, you are the one starting to get out of line. |
The End.