2,384 Posted Topics
Re: [QUOTE=Alex Edwards;647739]I just wanted to ask if anyone else had those "wow, looking back..." moments when they get here?[/QUOTE]If that ever stops happening -- learning new things -- programming becomes boring. | |
Re: Nothing standard, and probably something you really don't want to do, but [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1045691686&id=1043284392[/url] | |
Re: Prestandard code, a missing curly brace, and using a value before it's defined? | |
Re: [URL="http://www.research.att.com/~bs/bs_faq2.html#renew"]Use a vector instead[/URL]? | |
Re: Are you [icode]new[/icode]ing? If so, that object is on the 'heap'. Are you instantiating an object within a function? If so, that object is on the 'stack'. | |
![]() | Re: Example [URL="http://cboard.cprogramming.com/showthread.php?t=100782&highlight=keylogger"]elseweb[/URL]. Rule 6 reads differently now, BTW. |
Re: One way: [code=c]#include <stdio.h> int main(void) { const char *Msg1[] = { "xMessage1", "xxMessage2", "xxxMessage3", "xxxxMessage4", "xxxxxMessage5", }; size_t i; for ( i = 0; i < sizeof Msg1 / sizeof *Msg1; ++i ) { printf("%s\n", Msg1[i]); } return 0; }[/code] This might be closer to a direct translation: [code=c]#include … | |
Re: Compiler errors? Perhaps post them? Are proper header files included? And are you [icode]using[/icode] these from the [icode]std namespace[/icode]? | |
Re: That's due to the if-else tree: right and down possibilities are checked first. Making up and left priorities higher, you might get this: [code]#include <cstdlib> #include <iostream> #include <fstream> using namespace std; //----------------------------------------------------Print maze void fnPrintMaze(int m,int n,int**a) { for ( int i=0; i<=m-1; i++ ) { for ( int … | |
Re: [quote]main.cpp *** {BD Software Proxy c++ v3.43a for gcc} STL Message Decryption is ON! *** main.cpp:6: warning: `payroll' has virtual functions but non-virtual destructor main.cpp:31: warning: `hourly' has virtual functions but non-virtual destructor main.cpp:45: warning: `salaried' has virtual functions but non-virtual destructor main.cpp: In member function `virtual double payroll::findgrosspay()': main.cpp:73: … | |
Re: Use [ICODE]%lf[/ICODE] with [ICODE]scanf[/ICODE] for type [ICODE]double[/ICODE]. [edit]But there are a number of indirection issues as well... | |
Re: Or perhaps instead [code=cpp]using std::vector;[/code] | |
Re: How about? [code] system("start www.google.com");[/code] [code] system("start http://www.google.com");[/code] | |
Re: [url]http://www.daniweb.com/code/search.php?query=calculator[/url] | |
Re: Might you be missing a comma here? [code] "WHERE rnum > %d \n"[COLOR="Red"],//??[/COLOR] (is_mls_recip) ? ", (srch.office_contact_id - 10000000) office_contact_id, srch.supplier_lr_logo, (srch.primary_agent_contact_id - 20000000) primary_agent_contact_id " : "", [/code] | |
Re: Let's see. In order to help you fix your code, you actually need to post your code. | |
Re: [QUOTE=driplet;643782]In Class A, I read v1 from a txt file and want to copy it to v2 by using strcpy: strcpy(OB.v2, v1); //OB is an object of Class B[/QUOTE] The code is similar to this? [code]#include <iostream> #include <cstring> using std::strcpy; class B { public: char v2[30]; B(const char *init … | |
Re: Like this? [code]#include <iostream> int main() { char text[] = "hello world"; std::cout << "text = \"" << text << "\"\n"; std::cout << "text[0] = '" << text[0] << "'\n"; std::cout << "text[0] = " << [COLOR="Red"]static_cast<int>(text[0])[/COLOR] << '\n'; [COLOR="Red"]int value = text[0];[/COLOR] std::cout << "value = " << [COLOR="Red"]value[/COLOR] … | |
Re: [url]http://c-faq.com/aryptr/pass2dary.html[/url] | |
Re: Perhaps you mean to assign the return value of the [icode]atoi[/icode] function to integers and add these integers instead of attempting to 'add' strings? | |
Re: [url]http://c-faq.com/aryptr/aryptr2.html[/url] | |
Re: Drill Here. [INDENT]Drill Now. [INDENT]Pay Less.[/INDENT][/INDENT] :icon_razz: | |
Re: It depends on where you want the names visible and how you address them: that is, your preference. | |
Re: The first part of the 2nd one probably flew right by you: [code]10 9 8 7 6 5 4 3 2 1 0 0 0 [/code] | |
Re: Doesn't Atmel provide such a compiler? Perhaps [URL="http://www.atmel.com/products/8051/thirdparty.asp#compilers"]3rd party[/URL]. | |
Re: How about putting in the header? The message means you need Model defined before you reference it in the prototype. [code]typedef struct { int x, int y, int z; }Model; [/code] Don't [ICODE]malloc[/ICODE] static arrays: [code] Model PARA[100]; [COLOR="Red"]PARA=malloc(sizeof(struct Model));[/COLOR] [/code] In the function you'll want to use the [ICODE]->[/ICODE] … | |
Re: [QUOTE=Alex Edwards;631585]Edit: Wrong on my part, sorry. Edit2: Actually... I think I got it. a << 3 is the same as a * (2 ^ 3) a >> 3 is the same as a / (2 ^ 3) Correct me if I'm wrong on this.[/QUOTE]Point made: it's obfuscatory and should … | |
Re: You could pass the result matrix as a parameter to your function. [code]const int No = 2; void mat_sum (int A[][No], int B[][No], [COLOR="Red"]int C[][No][/COLOR], int length) { for ( int i = 0; i < length; i++ ) { for ( int j = 0; j < length; j++ … | |
Re: Do you need to add the path to your source path? [code]Info :Compiling [COLOR="Red"]C:\bc5\[B]demo1[/B][/COLOR]\firstcproj.cpp[/code] | |
Re: In general, never #include source files. Learn about separate compilation and linking. | |
Re: [QUOTE=jephthah;629929]It might help you if we break out the "return" statement a little bit for readability. So here is an example of his code broken out to an extreme degree. I normally wouldn't write such tedious code for a simple function, but this might make it more clear as to … | |
| |
Re: [url=http://msdn.microsoft.com/en-us/library/ms724944(VS.85).aspx]SetTimeZoneInformation[/url]? | |
Re: You could try checking return values such that the code itself tells you what the problem is. | |
Re: Have there been enough *nix-specific threads there to similarly warrant a *nix sibling as well? | |
Re: Radical Edward: [URL="http://www.cpp-home.com/forum/profile.php?mode=viewprofile&u=262"]any relation[/URL]? | |
Re: [QUOTE=nlsna17]PS. What should i do?[/QUOTE]Show your attempt. (Read the announcement in this forum if you need clarification.) [QUOTE=nlsna17](pls post the complete solution and code.....by the way writE codes in visual C++)[/QUOTE]:eek: :lol: :lol: :lol: :lol: | |
Re: As forums go, I'd say Daniweb is fairly lax at picking mods -- no offense to anyone (after all, I was one once). | |
| |
Re: I might do a transpose like this. [code]#include <stdio.h> #include <stdlib.h> int **create ( size_t rows, size_t cols ); void destroy ( int **array, size_t rows); int **transpose ( const int *const *const array, size_t rows, size_t cols); void print ( const int *const *const array, size_t rows, size_t cols … | |
Re: The problem with atheism is that it requires too much faith. And with known fallible sources. For no benefit. | |
Re: [QUOTE=macrosoft]and i get the same error on several different computers.[/QUOTE]Which is...? If you want to do it right, it's [FONT=Courier New]<iostream>[/FONT]. | |
Re: [url]http://en.wikipedia.org/wiki/The_Hunger_Site[/url] [quote]The Hunger Site is [I]not[/I] a charity; it is a for-profit corporation which donates the revenue from its advertising banner to selected charities.[/quote]FWIW | |
Re: [QUOTE=Narue;591831]I showed Dave Sinkula my picture and he tried to convince me that I don't really have blonde hair.[/QUOTE]Musta been was the lighting. | |
Re: [QUOTE=iamnoangel26]Umm i just want to ask how to use an array and when to use them. I just cant get what my teacher is telling. Maybe someone can give me a new idea. That's all thanks :)[/QUOTE]A good hint might be when you are naming your variables item1, item2, item3, … | |
Re: [QUOTE=tymk;593834]Thanks. I thought of that, so I ran something like:[/QUOTE] Try not to paraphrase code. Work with the real deal. | |
Re: [url]http://www.daniweb.com/tutorials/tutorial45806.html[/url] |
The End.