1,171 Posted Topics
Re: First some remarks on this statement: [ICODE]cout << triangle(n) << endl;[/ICODE] [B](1)[/B] ...and your [B]triangle()[/B] function [B](2)[/B]: [CODE] [B][COLOR="Red"]int[/COLOR][/B] triangle(int n) { if (n < 1) return 0; [COLOR="Red"]else [COLOR="Red"][B]{[/B][/COLOR][/COLOR] [COLOR="Green"][B]// where is that matching closing brace??[/B][/COLOR] triangle(n - 1); [COLOR="Red"]while(n > 0) { cout << n; n--; }[/COLOR] cout … | |
Re: [U][B]NOTE:[/B][/U] Throughout my whole post I assume that bytes consist out of eight bits. When you use the XOR-algorithm to hash/encrypt your data, there's no need to implement a different way to decrypt your data. XOR means: eXclusive OR. As you may know: a normal OR operation requires that either … | |
Re: [QUOTE=glyd;955843]My project is all about queue implementation... please write me a code about calculator with queue. tnx.[/QUOTE] Here's something essential, start from this and write the rest on your own: [CODE=c] #include <stdio.h> /* Your function declarations */ int main(void) { /* Your code here */ return 0; } /* … | |
Re: Wait, I doubt whether this program will correctly terminate on every machine, it appears that it won't, because you're using [ICODE]void main()[/ICODE], the standard says that you must use [ICODE]int main()[/ICODE] [B]and not[/B] [ICODE]void main()[/ICODE] ([COLOR="Red"][B]void main() is evil!![/B][/COLOR]) Further you're not using code tags (you should, as described in … | |
Re: Hey ggsddu, Don't you think your reply to this thread came quite late? (The thread is already dead for over a year) Another suggestion: Daniweb offers you the ability to wrap your code between [URL="http://www.daniweb.com/forums/announcement8-3.html"]code tags[/URL], make use of it, your code will be much easier to read that way … | |
Re: I guess you'll find this valuable: [url]http://www.daniweb.com/code/snippet151.html[/url] | |
Re: [QUOTE=thebluestar;955280]I don't understand your idea?[/QUOTE] [U][B]You asked:[/B][/U] [QUOTE] I don't know the difference between the direct entering value for element of matrix and through the temporary like code before. [/QUOTE] [U][B]Salem answered:[/B][/U] [QUOTE=Salem;955244]None at all springs to mind. At least none that matters.[/QUOTE] [U][B]Which means that:[/B][/U] He doesn't see an … | |
Re: To the OP: Broken [I]dot[/I]-key? As firstPerson said, we need to know exactly how well you know C++, otherwise we'll maybe suggest things which you'll find way to difficult to accomplish using your current knowledge. So, please make up a list for us (please be as specific as possible), and … | |
Re: Having a hard time using Google? My first advice before starting a new thread is: STFW first! [url]http://www.learncpp.com/cpp-tutorial/154-uncaught-exceptions-catch-all-handlers-and-exception-specifiers/[/url] (Exception specifiers) But I suggest you to read the two previous pages first. | |
Re: In addition to all what has already been said: No language is perfect, each language has it's advantages and disadvantages. | |
Re: [QUOTE]please help me i cant figure out what codes do i use..[/QUOTE] I'm sure you can, when you do some effort: [url]http://www.daniweb.com/forums/announcement8-2.html[/url] [QUOTE]please help me...[/QUOTE] Sure, don't take this wrong but I would like to see first that you've at least tried to solve it. | |
Re: Could you first explain us what your program is supposed to do, and how the [ICODE]-r[/ICODE] command line parameter should affect its output, so we don't have to puzzle everything out? | |
Re: [QUOTE=Hiroshe;952187]What do you mean by version 3 C? There are only 2 versions made by ANSI/ISO; C89 and C99. [/QUOTE] I guess he's using [B]Turbo[/B] [B]C[/B]rap [B]v3.0[/B] :P [QUOTE=chalumaal;952135]Hi Friends, I am facing a probelm. The moment I complete a program i C (version 3), it complies successfully. However, the … | |
![]() | Re: [QUOTE=niek_e;952431]These lines should give you a compiler error: [code=c] nop = atoi(number_of_people); user usera[nop]; [/code] C does not allow an array to be declared with an (at compile time) unknown amount of elements. If you want to use dynamic arrays, you should have a look at [icode]malloc()[/icode] and [icode]free()[/icode] What … |
Re: [QUOTE=alexa12345;951969]my intention was to compare two double numbers. Is there any better ideas how I can do that? Because you cant do just if(a>b) then..... where a and b are both double.[/QUOTE] I guess you'll find this useful: [url]http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.17[/url] | |
Re: I understand every single word in your post (except the words which consist out of one letter), but your whole post raises a syntax error with me (hope I'm not the only one). | |
Re: [QUOTE]What I am not understanding is, is it asking to be able to let the user enter each students name individually and then have it display a list of names with the grades associated with it?[/QUOTE] Hmm, smells like you need a structure (often abbreviated as: [B]struct[/B]). [B]structs[/B] are used … | |
Re: Having a hard time in solving logical questions? [url]http://www.daniweb.com/forums/thread211642.html[/url] | |
Re: [B]->[/B] is called the arrow operator and is often used to access the data members of a structure (via a pointer). Consider a structure which looks like this: [CODE=cplusplus] struct dog { string name; int age; }; [/CODE] Using that structure, someone could write code like this: [CODE=cplusplus] dog mydog; … | |
Re: You could already obtain a whole bunch of updates by simply installing: [URL="http://majorgeeks.com/Microsoft_Windows_2000_Unofficial_SP_d4817.html"]Microsoft Windows 2000 Unofficial SP 5.1.2195[/URL] Please note that this is a Service Pack, but it's unofficial, which means that it isn't created by Microsoft, read the README before installing it. After installing this unofficial SP5, you can … | |
Re: And....Another approach (maybe not the most efficient one): [CODE=cplusplus] bool isAnagram(string str1, string str2) { sort(str1.begin(), str1.end()); sort(str2.begin(), str2.end()); if(str1 == str2) return true; return false; } [/CODE] (You'll need to include the algorithm header file, you can do this by adding the following include directive to your program: [ICODE]#include … | |
Re: You'll have to make changes to this line: [ICODE]sprintf(filename, "%s,%i.,%i.,%i.txt", FileName, a,b,c);[/ICODE] I can say you: I know the solution, but please try it first, you'll learn a lot more from it. | |
Hi folks, I am [I]tux4life[/I], I'm not really new here anymore, but I was suggested to introduce myself (because I forgot to do so at the time I joined Daniweb). [U]Why am I here?[/U] Well, I'm here because I like helping people in general. I learned to know Daniweb via … | |
Re: [B]>thank you...hope you can help me with this... I need it tomorrow...[/B] Well, I can only help you if I see the code you have so far. | |
Re: [B]>please help me with my exercise... please give me sample on recursions with Fibonacci and Lucas number...[/B] That's just implicitly asking us to do your homework, but no problem, I can give you a link to loads of examples on the Fibonacci series: Look [URL="http://www.lmgtfy.com/?q=fibonacci+series+c%2B%2B"]here[/URL]. You'll find some examples on … | |
Re: For the first case: If your salary is 1000.23 it has to be 1000.25: We multiply 1000.23 by 20, round it off to the nearest integer and divide it back by 20 :) ... Edit:: In the second case (if your salary is 1000.26 and it has to rounded off … | |
Re: >[ICODE]string ss="this is an encrytpion program";[/ICODE] Could it be that you meant: [ICODE]char ss[] = "this is an encrytpion program";[/ICODE] here? Otherwise please clarify. | |
Re: [B]>I am having a hard time writing a program to do the following.........[/B] Please tell us where you're having problems with. | |
Re: [QUOTE=wildgoose;933762]How about reversing in place.............. [/QUOTE] Yes, but you'll need a closing curly brace (on the last line) in order to make the code compile :P | |
Re: Remove this line from your code (if you don't make use of the Allegro library): [ICODE]#include <allegro.h>[/ICODE] Or if you're using Allegro: If I'm not wrong each Allegro program looks like: [CODE] #include <allegro.h> int main() { allegro_init(); /* more stuff goes here */ return 0; } [B]END_OF_MAIN()[/B] [/CODE] So … | |
Re: @wildgoose: [B]stricmp()[/B] is a non-standard function and therefore isn't portable as well. However, everyone can quickly put together his own [B]stricmp()[/B] function, or use some kind of workaround to compare strings in a case-insensitive manner. | |
Re: [QUOTE=mathematician;933850]Most of Windows was written in C. You might or might not think that is marvellous.[/QUOTE] Please don't bring him on the idea to create his own OS :P | |
Re: Well, try this one: [CODE] wordRecord test; [COLOR="Green"][B]// (1)[/B][/COLOR] sc.printDict(test); [/CODE] [B](1):[/B] You can put [B]struct[/B] at the beginning of this line, but this isn't obligated in C++. | |
Re: You would better make use of arrays to avoid such huge switches. | |
Re: I don't see any mistake in your code, it works fine with me. Ensure that the file you're trying to open exists. But... Technically this line displays incorrect information: [ICODE]cout<<endl<<"File Not Found";[/ICODE] It's not because the file couldn't be opened, that the file automatically doesn't exist. For example it could … | |
Re: [QUOTE]1- (int argc, char *argv[]) .. what that refer to ..?[/QUOTE] You'll find more about this [URL="http://www.learncpp.com/cpp-tutorial/713-command-line-arguments/"]here[/URL]. [QUOTE]2- if (i%7 == 0)[/QUOTE] [B]%[/B] is the modulo operator, it returns the remainder of a division, for example 14%7 will return 0, but 15%7 will return 1. | |
Re: [QUOTE=Dream2code;932940] As an char takes 1 byte*(8 bits) in memory so it cant store only 256 distinct binary values (2^8).[/QUOTE] A char is one byte, but that doesn't make that it has always 8 bits, there are also machines where a byte consists of 6 bits for example. If you … | |
Re: Well, you just posted your assignment. Is there any code you wrote to follow? What do you have now? | |
Re: [URL="http://ptgmedia.pearsoncmg.com/images/0131473816/downloads/0131473816_book.pdf"]Cross-Platform GUI Programming with wxWidgets[/URL] :) | |
Re: [QUOTE=samli88;931960]How would u determine the end of a word using pointers?[/QUOTE] Here's an approach: [LIST=1] [*]First you read away all whitespaces. [*]Then you read until you come across a non-alphabet character. [*]Now you stop because you've reached the end of a word. [/LIST] | |
Re: [B]>Please do email me d code....n thanks for your assistance.[/B] Do you really think the people here at this forum are here to do your homework? We've better things to do. [url]http://www.daniweb.com/forums/thread78223.html[/url] [url]http://www.daniweb.com/forums/announcement8-2.html[/url] | |
Re: >can who suggest me for c mini project .... Yes, do a forum search. (it will give you plenty of ideas) >u can also give source code ..... No, you'll have to write that yourself. | |
Re: > [ICODE]s = system("sha1sum -t a.txt");[/ICODE] [B]system()[/B] doesn't return the output of an executed command. It returns an integer value, which indicates whether it could execute the command successfully or not. Edit:: Dream2Code posted before me. | |
Re: [url]http://catb.org/~esr/faqs/smart-questions.html#urgent[/url] | |
Re: WTF? Seems like you're even not using a compiler, but an interpreter... | |
Re: [U]Interesting info about [B]rand()[/B][/U]: [url]http://www.eternallyconfuzzled.com/arts/jsw_art_rand.aspx[/url] [U]Some code snippets:[/U] [url]http://www.daniweb.com/code/snippet1019.html[/url] [url]http://www.daniweb.com/code/snippet1034.html[/url] [url]http://www.daniweb.com/code/snippet1179.html[/url] | |
Re: You always have to pay attention when you create a vector of pointers, consider this: [CODE=cplusplus] #include <iostream> #include <vector> using namespace std; int main() { vector<int*> myvec(5); if( 5 > 3 ) { int a = 35; myvec[0] = &a; cout << *myvec[0] << endl; } cout << *myvec[0] … | |
Re: You want to act your program like this, right? [QUOTE] how many Fibonacci number you need? : 10 how many sequence: 3 21 34 55 [/QUOTE] Keep track of the amount of numbers already generated, when this amount exceeds [ICODE][I]the_amount_of_fibonacci_numbers_you_need[/I] - [I]sequence[/I][/ICODE], you start printing the numbers. (In this case … | |
Re: This thread is already about 2 years old, and you're still replying in it. If someone wants to read a good book about C++, then he can check out [URL="http://www.daniweb.com/forums/thread70096.html"]the sticky[/URL] about that. Maybe for further interest: [URL="http://catb.org/jargon/html/B/bullschildt.html"]___________[/URL]. | |
Re: [LIST=1] [*]Create a pointer [B]p[/B] (feel free to choose another name) to the string where you want to find the substrings in. [*]Run [B]strstr()[/B] on that pointer, as long as the return value isn't [B]NULL[/B] and [B]p[/B] doesn't point to the NULL-terminator of that string. [*]Increase the pointer with one. … |
The End.