377 Posted Topics
Re: [QUOTE=ShawnCplus;420059] [code=c++] int main(void) [/code][/QUOTE] In C++ this is considered bad style. In fact, the main(void) style has been called an [URL="http://www.research.att.com/~bs/sibling_rivalry.pdf"]"abomination"[/URL] by Bjarne Stroustrup, the creator of C++, Dennis Ritchie, the co-creator of C, and Doug McIlroy, head of the research department where Unix was born. | |
Re: Also correct the way you use exception handling in code. | |
Re: Here's another [URL="http://www.cplusplus.com/doc/tutorial/exceptions.html"]tutorial[/URL] | |
Re: [QUOTE=Ashu@sym;426879]hello everyone, i am a rookie in C++ programming, can someone please clarify my one doubt regarding difference between handles and pointers ?? actually i am little confused about handles, can any one please clarify what exactly is a Handle and why is it used??[/QUOTE] The term handle is used … | |
Re: [QUOTE=TkTkorrovi;425631] [code] printf ("== press enter ==\n"); getchar (); [/code] [/QUOTE] This would be better [code=c] printf("Hit 'ENTER' to exit\n"); fflush(stdout); (void)getchar();[/code] | |
Re: [QUOTE=joydsouza90;425218]How do you clear a string in a single statement ? for egs. i want to clear name[20] of all its contents and leave it completely empty Please help :-/[/QUOTE] [code=c++] const char *str="SpS"; cout << str; str = NULL; [/code] | |
Re: > I need to display 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ... I "must" use the "for" ... This is what I have but it only counts by two. I don’t want the answer ... however can you please give me some clues on the proper … | |
Re: [quote=tonyaim83;425113]How do i create a 2-D array using a vector which is dynamic in nature. [/quote] You can make use of [INLINECODE]vector<vector<T> >[/INLINECODE] | |
Re: [quote=tonyaim83;425110]How do i create a two dimensional dynamic array of type string using vector. Also let me know if how can i use "find" on this array..[/quote] You could approach like this [CODE=c++] #include <vector> template <typename T> class dynamic_array { public: dynamic_array(){}; dynamic_array(int rows, int cols) { for(int i=0; … ![]() | |
Re: [quote=zmariow;424263]Dynamic Binding is a concept that applies to Object Oriented Programming. C is not object oriented. What is it you're trying to do... explain more and maybe we can give you some ideas :)[/quote] Objective-C is a language based upon C, with a few additions that make it a complete, … | |
Re: [quote=Darnie;423959]If you have an example please help me[/quote] [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: Internet File Downloading Function [URL="http://www.daniweb.com/forums/Internet%20File%20Downloading%20Function"]http://www.codeguru.com/cpp/i-n/internet/filetransfer/article.php/c3399/ [/URL] | |
Re: [quote=Boldgamer;422307]I don't know. But most here will tell you to never use void main()[/quote] Startup routines that call [B]main[/B] could be assuming that the return value will be pushed onto the stack. If [B]main()[/B] does not do this, then this could lead to stack corruption in the program's exit sequence, … | |
Re: I would highly recommend [URL="http://www.codeblocks.org/"]CodeBlocks[/URL] | |
Re: You can provide static create() member functions which create the object using new and return a pointer to the allocated object. [code=c++] typedef auto_ptr<Test> TestPtr; TestPtr Test::create() throw(bad_alloc) { return new Test(); } [/code] | |
Re: [QUOTE=AquilesBailo;421627]Hello everyone ^_^ I need to know how to pause the execution of a code, without using sleep() or any sleep()-kind function thats it... thanks XD[/QUOTE] In C++, you can do something like this [CODE=c++]#include <iostream> #include <limits> int main() { // Rest of the code //Clean the stream and … | |
Re: Read this [url]http://www.eternallyconfuzzled.com/tuts/languages/jsw_tut_pointers.aspx[/url] | |
| |
Re: Just take [inlinecode]typedef int value_type;[/inlinecode] out of class. Things should work. | |
Re: You can use [inlinecode]istringstream[/inlinecode] [code=c++] #include <sstream> #include <iostream> int main() { std::istringstream stm; double number; stm.str("6.8123456789123456789123456789"); stm >> number; std::cout<<"Converted Value: "<<number; return 0; } [/code] | |
Re: Read about [url=http://www.c-faq.com/expr/seqpoints.html]Sequence Points[/url] | |
Re: [quote=almy;421828]what u mean???the flow code???sorry coz i'm 1st year at university so i dont know about this...:-p[/quote] You can make use of [INLINECODE]qsort()[/INLINECODE] or [INLINECODE]std::sort[/INLINECODE][B][/B] | |
Re: So, you are having trouble with language constructs or logic? | |
Re: In case [inlinecode]char *name="Yankee Duddle";[/inlinecode] string literal turns into an unnamed, static array of characters, and this unnamed array may be stored in read-only memory, and which therefore cannot necessarily be modified. Trying to modify it is undefined behaviour. Whereas in case of [inlinecode]char name[]="Yankee Duddle";[/inlinecode] you can modify the … | |
Re: Try this [code] CC=g++ ass1: main.o ass1.o $(CC) main.o ass1.o -o ass1 main.o: main.cpp ass1.h $(CC) -c main.cpp ass1.o: ass1.cpp ass1.h $(CC) -c ass1.cpp[/code] | |
Re: Classes are a way to localize all the state (data) and services (typically member functions) associated with a cohesive concept. The main idea is to organize things so that when changes to the concept or abstraction occur (as is inevitable), it will be possible to go to one place to … | |
Re: [QUOTE=sainiricha;400866]Can anyone help me out to start graphics in C!!! i cant understand what books i need to reffer n which online tutorials i should take!![/QUOTE] You can make use of [URL="http://www.hypertriton.com/agar/"]AGAR[/URL] Agar is a set of libraries for developing graphical applications that are portable to numerous platforms. Agar is … | |
Re: [URL="http://www.codeproject.com/cpp/Reversedisasm.asp"]C++ Reverse Disassembly[/URL] | |
Re: Sample code [code=c++] #include <iostream> using namespace std; int main() { int x; // A normal integer int *p; // A pointer to an integer p = &x; // Read it, "assign the address of x to p" cin>> x; // Put a value in x, we could also use … | |
Re: You can add validation to your code by doing somthing like this [code=c++] #include <iostream> #include <algorithm> #include <sstream> using namespace std; struct nondigit { public: bool operator() (char ch) { return !isdigit(ch); } }; int main() { int num; string str; bool flag=false; cout<< "Enter number: "<< endl; cin>>str; … | |
Re: Make your own by using [B]strstr()[/B]. | |
Re: [QUOTE=jan1024188;294909]Im realy confused now...could you write an example?[/QUOTE] Search the snippets section. You'll find code for that. | |
Re: I've used both of them and I find Code::Blocks much lighter and equally powerful as DEV C++. | |
Re: [QUOTE=Mr.UNOwen;293232]1 How do I do it the portable way? -find file size[/QUOTE] Since you mentioned C, so I cannot suggest you Boost::Filesystem You will have to use platform specific codes like [inlinecode]stat[/inlinecode] of unix and some equivalent function in windows with chain of #ifdef's. You can also use [inlinecode]fstat[/inlinecode], or … | |
Re: You don't need to start duplicate threads for same problem. Check this [URL="http://en.wikipedia.org/wiki/Scheduling_algorithm"]Scheduling Algorithm[/URL] | |
Re: [QUOTE=nuwan243;294183]08)Can we read from a port while write to the same port? When we short the TX and Rx pins the value TX can be captured from the same port as a data read from port?[/QUOTE] [URL="http://www.eng.auburn.edu/~doug/serial.html"]Serial Port Programming[/URL] | |
Re: [QUOTE=Boldgamer;293530][COLOR=#000000]Hello everyone. I am interested in learning C++ and am looking for a good book to start out with. I read the topic in the sticky in this forum and have narrowed my choice of beginner books down to either [/COLOR] [COLOR=#000000] [/COLOR] [COLOR=#000000]A) [/COLOR][COLOR=#000000]C++ How to Program by [COLOR=black]Harvey … | |
Re: I can't understand your question? Image shell? ![]() | |
Re: [QUOTE=DynamitMsk;293114]Hi everyone, I've been working on this for days, but just can't get it. I have a linked-list containing edges of a weighted directed graph, and my goal is to find a path from vertex A to vertex B going through exactly n nodes. Anyone has suggestions, or links with … | |
Re: [QUOTE=kenshihimura;292352]Somebody can help me on this simple VB C++ program?[/QUOTE] [url]http://www.daniweb.com/techtalkforums/announcement8-2.html[/url] | |
Re: [QUOTE=adam37;292254]Hi, I'm revising for an exam comming up in C Programming. Can anyone help by answering some typical questions which might come up in the examination. Any help would be appreciated. [B][U][COLOR=#000000]Basic data types[/COLOR][/U][/B] [U][COLOR=#000000] [/COLOR][/U] [LIST] [*][COLOR=#000000]What are the different types of data?[/COLOR] [*][COLOR=#000000]What are signed and non-signed data … | |
Re: [QUOTE=kararu;291688]The differences are listed here [URL]http://www.geocities.com/karthika_79/diff.html[/URL] hope this helps, karthika[/QUOTE] Anyone following this thread, read this instead [url]http://david.tribble.com/text/cdiffs.htm[/url] | |
Re: [QUOTE=spaceboy;290952]I'm looking for a C++ certification course, but there seems to be about 1001 offerings on the net, and the last thing I want to do is spend my money on something that employers won't recognise as legitimate.[/QUOTE] You can get a very good job without a certification in C++ … | |
Re: [QUOTE=andrax;291720]Sorry, I was looking for something a little simpler and little more free :P[/QUOTE] [URL="http://www.codeproject.com/tools/visualleakdetector.asp"]Visual Leak Detector[/URL] | |
Re: In addition to what above poster is saying, you need to seed the random number generator using srand(). | |
Re: Please use code tags while posting code. What do you not understand in the output? If you are wondering about increase in size of class C then read about virtual functions, virtual table, virtual pointer etc. | |
Re: Input is always three numbers of two digits or it can be 'n' numbers consisting any number of digits? | |
Re: [QUOTE=mistermister;291091]but why that was happening with me i cant got it, why just printing the last line ???????[/QUOTE] Nick replied to that. Read again [QUOTE=Nick Evan;291086]You're only executing this: [inlinecode]sprintf(value,s); [/inlinecode] in your while loop. What you want to do is: [code=cplusplus] while(fgets(s,1000,f) != NULL) { sprintf(value,"%s", s); printf("%s",value); } … | |
Re: [QUOTE=omlaka;291129]Hi All,As usual. I am a silent member until I have passed my exam. Recently, I passed my exam with 95% for 1Z0-042. Meaning 95% of the questions are from certmagic.com guide. There a few new questions, which I am not familiar with. These questions would be remaining 5% of … |
The End.