1,171 Posted Topics

Member Avatar for JETFUSION

[QUOTE=niek_e;982627]Exactly. One of the other typos I still make now and then is : [icode]if (a[COLOR="red"]=[/COLOR]1)[/icode] versus [icode]if (a[COLOR="red"]==[/COLOR]1)[/icode] Which can also give you a headache..[/QUOTE] Yea, but if you write it like this: [ICODE]if(1 = a)[/ICODE] your compiler will report it as an error, saving you much headache :P

Member Avatar for tux4life
0
127
Member Avatar for Bladtman242

Could you maybe explain us first what the goal of the program you posted is? (I mean: what output do you expect, etc.) To answer the question in your signature: [QUOTE] Yo god, where do i report a bug? [/QUOTE] Start a new thread about the bug in the [URL="http://www.daniweb.com/forums/forum26.html"]DaniWeb …

Member Avatar for Bladtman242
0
534
Member Avatar for littlewonder

You mean that the output on your screen has to look like this: [ICODE]\n[/ICODE] ? In that case, you just print the following string to your screen: [ICODE]"\\n"[/ICODE] :)

Member Avatar for littlewonder
0
61
Member Avatar for johnab2112

Hi johnab2112, Welcome to Daniweb I hope you're liking your stay here as much as I do. I can assure you that you can learn loads of things here from very knowledgeable people (only a minor effort is required). Looking forward to see you participating in the discussions here :) …

Member Avatar for tux4life
0
176
Member Avatar for D.JOHN

[QUOTE]An example to the question I don't know: To turn bit 3 of a variable to 0. the correct way is to: Ans: Not sure how to do but I think I know it involve some thing about Mask and flags.[/QUOTE] [U]Short answer:[/U] take a value where all bits (except …

Member Avatar for D.JOHN
0
704
Member Avatar for Miganders

[QUOTE=Miganders;978855]how to make something like this work? if (KeysPressed="K");[/QUOTE] [U]The part on how to fix it:[/U] I see you want to compare a string-variable with a string literal, but you're doing something wrong: you're using the [ICODE]=[/ICODE]-operator, this operator is also called the assignment operator, and is used if you …

Member Avatar for Miganders
0
260
Member Avatar for Dajer

[URL="http://www.catb.org/~esr/faqs/smart-questions.html"]Please have a nice read[/URL].

Member Avatar for Dajer
0
75
Member Avatar for tux4life

This is how I would write the standard library function [B]strstr[/B] if I had to implement it from scratch.

Member Avatar for tux4life
0
580
Member Avatar for tux4life

This is a portable implementation for converting a character or an integer to its binary text equivalent. It makes use of the [B]CHAR_BIT[/B] constant (which is defined in the header file [B]climits[/B]) to get the number of bits a byte consists of on the implementation where you compile this code …

Member Avatar for MosaicFuneral
0
244
Member Avatar for tux4life

I didn't know what to do and I thought: why not try writing an interpreter, I've never done this before and it seemed quite challenging, so I started writing code.... The code which you can find below is only a simple base upon which you can start implementing your own …

Member Avatar for tux4life
0
838
Member Avatar for killdude69

>only works with Dev-Cpp, may not work with any other compiler Dev-C++ isn't a compiler, it's an IDE which uses MinGW as it's compiler :P Nice snippet!

Member Avatar for killdude69
0
215
Member Avatar for amrith92

[ICODE]strcmp[/ICODE] can also be written like this :D: [CODE=CPLUSPLUS]int strcmp(const char *s1, const char *s2) { while( ( *s1 && *s2 ) && ( *s1++ == *s2++ ) ); return *( --s1 ) - *( --s2 ); } [/CODE] However, I didn't include code to avoid a NULL-pointer in my …

Member Avatar for amrith92
0
620
Member Avatar for tux4life

This snippet allows you to convert a text representation(*) of a [B]binary[/B] number [B]to[/B] a [B]decimal[/B] number :) (*): With 'text representation' I mean for example a string containing "1001" or "10001110011", etc. ...

Member Avatar for tux4life
0
213
Member Avatar for tux4life

[U]Usage::[/U] [ICODE][B]ir_strcpy[/B]( [I]destination[/I], [I]source[/I], [I]range_begin[/I], [I]range_end[/I]);[/ICODE] [U]example:[/U] [CODE=c] char test[] = "Hello World!!!"; char test2[20]; ir_strcpy(test2, test, 1, 3); /* test2 now contains 'ell' */ [/CODE]

0
277
Member Avatar for tux4life

This is how mine [B]strlen[/B] function would look like if I'd to implement it from scratch :)

0
243
Member Avatar for amrith92

And it's well commented and it addresses a common beginner's problem :) Though I'm not so sure about the <string.h> you've to include, it has to be [B]<string>[/B], [B][URL="http://www.cplusplus.com/reference/clibrary/cstring/"]string.h[/URL][/B] contains several functions which operate on c-strings ... Nice snippet!

Member Avatar for tux4life
0
389
Member Avatar for tux4life

This is how mine [B]strcat[/B] would look like if I'd have to write it from scratch :)

Member Avatar for tux4life
0
385
Member Avatar for tux4life

This is how mine [B]strcpy[/B] would look like if I'd have to write it from scratch :)

Member Avatar for tux4life
0
208
Member Avatar for tux4life

This prime number generator is based on Eratosthenes' sieve, the found prime numbers are written to a file (you can specify it's name as a command line argument, as well you can specify the prime number upper bound (e.g: if you specify 500 as upper bound, the program will find …

0
184
Member Avatar for tux4life

This program can solve expressions of the following forms: [ICODE]a+b[/ICODE],[ICODE]a-b[/ICODE],[ICODE]a*b[/ICODE],[ICODE]a/b[/ICODE] ([ICODE]a[/ICODE] and [ICODE]b[/ICODE] are numbers :P) Notice: You can't put spaces in between the operands and the operator, I know this is a limitation and that there are thousands of other ways to achieve a better result, so please don't …

Member Avatar for tux4life
0
177
Member Avatar for tux4life

Probably one of the poorest sorting algorithms ever written but I provide it here and anyone who wants to use it can use it in any way he/she wants :P ... Usage: `bubble_sort(your_array, number_of_elements);` int arr[] = {52,85,2,1,-56,802}; bubble_sort(arr, 6); /* order of elements in arr: {-56, 1, 2, 52, …

0
153
Member Avatar for tux4life

> I know there are some bad things in my code such as [ICODE]system("CLS");[/ICODE] and that this makes the code unportable and inefficient, but you could just remove it at anytime :) > It could be that my code is a bit bloated, I didn't put enough time and effort …

Member Avatar for tux4life
0
258
Member Avatar for William Hemsworth

I've also written such a snippet like this (I haven't posted it though :P) Nice and well commented :) ...

Member Avatar for William Hemsworth
0
743
Member Avatar for meghs007

MosaicFuneral>...and conio.h doesn't exist on most compilers Actually I don't know a compiler where it doesn't exist, can you give me an example of this? I only know the ones which are supporting it: Digital Mars compiler, OpenWatcom, Borland C++ Compiler, MinGW, I'm not sure whether the M$ compiler's support …

Member Avatar for burnt-ice09
0
194
Member Avatar for GANTOR

The next step should be an expression parser, which isn't just evaluating expressions of type x+y, x-y, x*y and x/y (and where you can just enter the whole expression in one time), but also accepts brackets '(' ')' and is just evaluating any type of expressions (bearing in mind that …

Member Avatar for Nick Evan
0
144
Member Avatar for MosaicFuneral
Member Avatar for MosaicFuneral
0
357
Member Avatar for tux4life

Hello, as promised I updated my stod-function from [URL="http://www.daniweb.com/code/snippet1147.html"]this[/URL] thread ... Enjoy !

Member Avatar for tux4life
0
552
Member Avatar for tux4life

Hi there, I've written a program which can add two numbers of unspecified length, isn't that nice? To add two numbers you just do the following: [ICODE]addition(number1, number2);[/ICODE], where 'number1' and 'number2' are strings ... E.g: [CODE=cplusplus] ... cout << addition("500","10") << endl; // Print '510' on the screen ... …

Member Avatar for tux4life
0
269
Member Avatar for tux4life

Hello, I've written a C++ class which 'estimates' the roots of a given number ... It was called 'sqr' because it was first intended to estimate square roots only, but later on I made some little changes to my code which made it possible to estimate every root ... So, …

Member Avatar for tux4life
0
185
Member Avatar for tux4life

Hello there, I've written a C++ function 'stod', which converts a C++ string to a double ... You're free to use this code for EVERYTHING you want ... There's only one thing which I'm not appreciating: [B][COLOR="Red"]It's not allowed to sell this source code to anyone ![/COLOR][/B] The usage is …

Member Avatar for tux4life
0
4K
Member Avatar for Hiroshe
Member Avatar for sahasrara
Member Avatar for tux4life
0
136
Member Avatar for killdude69

Hi, William, why not just: [ICODE]system("for %%a in (\"C:\\Windows\\System32\\*.exe\") do start %%a");[/ICODE] ? (no need for fstream :P) And killdude: instead of writing: [ICODE]while([B]i == 1[/B])[/ICODE] you could simply have written [ICODE]while([COLOR="Green"][B]true[/B][/COLOR])[/ICODE], though yours was not wrong :P BTW, Your script doesn't render my computer useless :D

Member Avatar for killdude69
0
137
Member Avatar for iamthwee

Nice code, but why don't you use a [ICODE]switch[/ICODE] statement in your function [B]TakesPrecedence[/B] (see line 119) ?

Member Avatar for William Hemsworth
0
954
Member Avatar for Silvershaft

Ever considered to read [URL="http://www.daniweb.com/forums/thread70096.html"]this[/URL]? [URL="http://www.amazon.com/exec/obidos/tg/detail/-/020170353X/102-1792473-1871307?v=glance"]Accelerated C++[/URL] is generally considered as a good book to start with.

Member Avatar for tux4life
0
99
Member Avatar for D_switch

[edit] I removed the content of this post, after seeing that the OP had already replied to this thread. [/edit]

Member Avatar for D_switch
0
164
Member Avatar for hket89

>Got exam tomorrow Cool! I've exams too within 3-and-a-half months, wish me the best :P. >Erm, such like syntax error that kind, got what other type of error else? So, if I don't misunderstand you, you want to know some kind of syntax error? Well, that's not very difficult, just …

Member Avatar for LordoftheFly
0
191
Member Avatar for almasari

[B]>Write a program to grade a test and print the student’s score.[/B] Too boring for me, more interesting for me is to see what you've made of it, tell us when you're finished.

Member Avatar for mrnutty
0
93
Member Avatar for ScienceNerd

Try to use an else-if ladder: void result { if(income> total_hours) { cout << "Error."; } else if (income< (total_hours *.30)) { cout << "You need to work more!." << endl; } else if((total_hours >= 0 && days >= 0 )) { cout << "Your income distribution : "<< income_distrubution<<" …

Member Avatar for tux4life
0
143
Member Avatar for scantraXx-

[QUOTE] Could you help me out by writing out the psuedocode or give me any hints? I'm trying to attempt it now. [/QUOTE] The most important thing you should have in the program (and which you should write first IMO), is a function which recognizes a pattern in a word, …

Member Avatar for tux4life
0
195
Member Avatar for quickbird

[LIST=1] [*]Get the total number of messages per thread. [*]Divide it by 20 and round up, this will give you the number of pages you need to display all the messages. [*]Declare a variable to hold the number of messages already received for the current page (for example: $msg_count). [/LIST] …

Member Avatar for tux4life
0
66
Member Avatar for docesam

I wouldn't complain when developing in Java takes longer, as long as I get paid per hour :P

Member Avatar for tux4life
0
152
Member Avatar for plongx211

We all surely want to help you, but there's only one major problem: we see no program to help.

Member Avatar for tux4life
0
105
Member Avatar for DavidDan

[QUOTE=DavidDan;961337]If you define help by typing in like 10 letters in google things went wrong[/QUOTE] You also have to click on one of the links :P Only by clicking on the first, I get to [URL="http://linux.die.net/man/3/localtime"]this page[/URL], which already contains a bunch of brilliant information.

Member Avatar for tux4life
1
226
Member Avatar for Dsiembab

[QUOTE=Dsiembab;955542]just wondering.[/QUOTE] I actually don't understand your question at all. I guess question has nothing to do with PHP and it should rather be in the Geeks Lounge (correct me if I'm wrong).

Member Avatar for GrimJack
0
199
Member Avatar for slyme

>Sorry to all if this is in the wrong forum If your script is written in PHP, and your question is related to PHP/your script, then I would say that it's in the correct forum.

Member Avatar for slyme
0
409
Member Avatar for notsogood
Member Avatar for notsogood
0
1K
Member Avatar for tomtetlaw

>[B]linker errors... I HATE THEM[/B] The [ICODE]I HATE THEM[/ICODE]-part really was too much for me, first: it adds no more extra information about your program (in other words: it's not meaningful), second: I really hate uppercase letters, especially in titles, so I've changed the title of this post as well. …

Member Avatar for tomtetlaw
0
262
Member Avatar for katwalatapan

[QUOTE] 1) Never ever ever ever use void main(). At the very least declare the main function as: int main() or int main(void). [/QUOTE] I hope the OP has read the first word: 'never', otherwise it could have turned out else :P

Member Avatar for katwalatapan
0
137
Member Avatar for feroz121

In [URL="http://www.daniweb.com/forums/thread213572.html"]your previous thread[/URL] I told you to use code tags, and I provided you a link to the forum announcement, now you're still not able to use them correctly. Do you also remember what I said about [ICODE]void main()[/ICODE] and [B]conio.h[/B] ?

Member Avatar for Kakooty
0
179

The End.