6,741 Posted Topics
Re: [B]>I'm well aware that I need to find greener pastures[/B] Keep in mind that it takes a lot of shit to keep those pastures green. ;) | |
Re: [B]>please give me the "C" language code for reversing a two dimensional character array.[/B] No, piss off. We don't do homework for lazy students. [B]>Please its very urgent.[/B] I feel no sense of urgency. In fact, I'm quite content with watching you slowly come to the realization that you're going … | |
Re: [B]>I want to limit the amount of characters used to 10.[/B] Note the difference between limiting the number of characters [i]used[/i] and limiting the number of characters the user can [i]type[/i]. The latter is rarely needed, requires excessive work on your part to simulate shell input, and is guaranteed to … | |
Re: [QUOTE=edgias;1160674]Hello guys! In my application i have textbox where a student has to enter his/her name.I have validated it so that it accepts only letters but the problem is if i want to delete something when typing i have to use the delete button only.I cant use the space tab … | |
Re: You show us your answers and we'll tell you if they're right. Daniweb is not a homework service. | |
Re: Oddly enough, I answered this very question on [url=http://cboard.cprogramming.com/showthread.php?t=60433]another forum[/url] yesterday. The trick is to convert the expression to postfix so that you can easily evaluate it with a stack based approach. Alternatively, you could build an expression parse tree, but that just adds extra unnecessary steps in most cases. | |
Re: [B]>bump[/B] Well well well, you must be the lord and master of the universe to push all of the other threads down and give yours immediate priority. Did it not occur to you that bumping is rude? How about that those of us who could easily help you right now … | |
Re: Double the brace up: [code] Console.WriteLine("{0} ... {{", var1); [/code] [URL="http://msdn.microsoft.com/en-us/library/txafckwd.aspx"]MSDN[/URL] clearly states what happens in the format string: [quote] Opening and closing braces are interpreted as starting and ending a format item. Consequently, you must use an escape sequence to display a literal opening brace or closing brace. Specify … | |
Re: [B]>the error might be here ...[/B] It might. [B]>new_student->name = (char *)malloc(8 * sizeof(char));[/B] You allocate memory to name, all is well so far (barring minor nits). [B]>new_student->name = "Michael\0";[/B] Bzzt! You've now overwritten your [i]only[/i] reference to the memory just allocated. Not only is this a memory leak, if … | |
Re: [B]>I want to know what is "Vector for the buckets in hash table".[/B] My assumption would be someone wants you to write a chained hash table using vectors instead of the more traditional linked list. The end result is an array of vectors, where the array index is your hash … | |
Re: I assume you mean [URL="http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_bst1.aspx"]examples of implementation[/URL]. | |
Re: You didn't do any research did you? On top of being pretty freaking easy if you know XSLT or basic XML processing in .NET, a simple search on google gives you complete solutions. | |
Re: Well, how you do it depends on a few things that you didn't specify, so I'll just throw out one possible solution to get your creative juices flowing: [code] using System; using System.Linq; using System.Globalization; using System.ComponentModel; using System.Collections.Generic; namespace JSW { static class Program { static void Main() { … | |
Re: [B]>I'm trying to make a button that saves Multiple text >boxes in to 10 lines and 16 characters per line[/B] Be specific about the number and contents of each text box. Are we talking ten text boxes of up to 16 characters? [B]>only found stuff for VB[/B] VB can be … | |
Re: [B]>I just can't figure out how it is supposed to be implement >with the extra array element structure in the middle.[/B] It's just an array of linked lists: [code] struct Hotel { std::string name; LinkedList<Attendee> attendees; }; Hotel hotels[5]; [/code] [code] for (int i = 0; i < 5; i++) … | |
Re: [B]>int[] nbrs = new int[balls];[/B] This (line 11) declares a local variable in your constructor that hides the class field. You initialize the local array, but the class field remains null. Change it to this: [code] nbrs = new int[balls]; [/code] | |
Re: [B]>I am new to compiler construction.[/B] Cool. It's a fun an interesting area. [B]>I wanted to use lex tool.[/B] I strongly recommend writing everything by hand at first. You can use generators when you understand the principles behind the generators and want to work faster. It's much like using a … | |
Re: If you're interested in becoming a Java developer, why does Visual Basic even come into the picture? It's a completely separate langauge. Yes, learning more than one language is a good idea, but I honestly don't understand what your question is or why you're asking it. | |
Re: [B]>scanf() is a crappy function that does crappy things to >the program. Get over it and use functions that actually work.[/B] scanf works just fine. The problem is ignorant programmers who don't understand the rationale behind it. Calling scanf crappy after trying to read interactive input is much like calling … | |
Re: You realize that the >> operator for input is is default delimited on whitespace, right? | |
Re: I take it you haven't bothered to read the [URL="http://msdn.microsoft.com/en-us/library/ms683219%28VS.85%29.aspx"]documentation[/URL]? | |
Re: [url=http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx]This[/url] and [url=http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_hashtable.aspx]this[/url] should give you enough of the basics. | |
Re: [B]>fseek() does not work well with text files.[/B] More specifically, random offset access using fseek isn't guaranteed to be meaningful on text files. On a text file, you need to get some position indicators with ftell first, otherwise you're limited to boring stuff like seeking to the beginning of the … | |
Re: [B]>One of the Advantage of the Pointers is "FAST ACCESS" comparitively to variables[/B] I think you misunderstood whoever told you that. The performance difference of pointers is usually described in terms of array indexing: [code] int a[10] = {0,1,2,3,4,5,6,7,8,9}; int *p; int i; for (i = 0; i < 10; … | |
Re: I interpret it as the function is supposed to perform input as well as calculate the total. So your main would be something like so: [code] int main() { int n = 10; std::cout<< total(n) <<'\n'; } [/code] | |
Re: PHP's regular expression syntax is based on Perl, right? Boost uses Perl style regular expressions by default, so there shouldn't be a significant difference (at least not one you can't tweak in a few minutes of trial and error). | |
Re: Array sizes must be constant in C++. If you want to get the size from input, you need to use a container class (such as std::vector), or simulate an array using pointers and dynamic memory. | |
Re: [B]>So whats the difference between the two?[/B] The member operator binds more tightly than the indirection operator, so the net effect of [ICODE]*pmovie.title[/ICODE] is [ICODE]*(pmovie.title)[/ICODE]. To match [ICODE]pmovie->title[/ICODE] you need to force the indirection first with [ICODE](*pmovie).title[/ICODE] | |
![]() | Re: [B]>why is he using a[j] = tmp; at line 14??[/B] [ICODE]tmp[/ICODE] is the value being inserted. The loop prior to [ICODE]a[i] = tmp;[/ICODE] is simply a shift to make room for the new value. [B]>Won't it reset the value given by the code in line 13??[/B] No. Step through the … |
Re: [B]>Any suggestions would be greatly appreciated.[/B] I get the impression you want a variable argument list. Something like this: [code] #include <stdio.h> #include <stdarg.h> void foo(int ints, int floats, ...) { int sum_int = 0; double sum_float = 0; va_list args; va_start(args, floats); /* Get the ints first */ while … | |
Re: [B]>Compilers are free to make them any size they want.[/B] Within limits. A long integer in C is absolutely required to be at least 32 bits, so as long as you you can ignore the bits of a larger size, you're solid. C99 introduces the <stdint.h> header where exact-size types … | |
Re: [B]>there's a difference ...[/B] Only in your mind. What you described is exactly what sprintf will do for you. | |
Re: Well, it's pretty freaking easy when you don't have to calculate the binomial coefficients. Just two trivial loops if you don't want leading whitespace and three if you do. [B]>i want code for this.[/B] Then you'd better get started on writing it. [B]>pls giv me the code[/B] No. And saying … | |
Re: [B]>Now let’s check out what will be the disadvantage of _alloca over new/malloc :- >1) One has to be cautious while using alloca for huge blocks. >2) Its scope is limited to a function call. >3) As stack overflow is not a standard C++ exception, one hast to use structured … | |
Re: [B]>How can this be simplified for ease of understanding.[/B] Obviously it could be broken down into multiple expressions in sequence rather than one monolithic tongue twister. | |
Re: [B]>i want to give a presention on functions use in code[/B] [B]>can any one help me ,as give me these codes?[/B] Wait. You're giving a presentation on something that you don't even know how to do? | |
Re: [B]>D.resize(3, temp);[/B] Well that's wrong, and it shouldn't even compile. [ICODE]temp[/ICODE] is an array of double and that particular overload of resize takes a value of type T (that the vector was declared with). Since T is double, it's a type mismatch. [B]>F.resize(3, temp);[/B] This is equally wrong for the … | |
Re: [B]>when should i use "return 0;" at the end of a main() function?[/B] Always or never, depending on your preference and whether or not you're writing standard C++. In standard C++ 0 is returned automagically when execution falls off the end of main, so the following is perfectly valid: [code] … | |
Re: Assuming variable is of type char, you were close to correct syntax: [ICODE]variable == '\"'[/ICODE]. But because you're comparing against a character, you don't need to escape the double quote, so [ICODE]variable == '"'[/ICODE] works equally well. | |
Re: [B]>when i run the program i got the same out put by using memcpy and memmove[/B] There's nothing stopping an implementation from implementing memcpy in terms of memmove. Further, calling memcpy on overlapping memory invokes undefined behavior. It may or may not fail. [B]>what is meant by moving memory and … | |
Re: [B]>let's call it Array[/B] Let's not. How about you write a small program that fails, and one of us can tell you why. [B]>Can you show me the direction here?[/B] No. Taken in isolation, your code is correct. Post something with more substance if you want help. | |
Re: >Huh? Whatcha mean? He means that this question has been spammed on multiple website forums, such as Daniweb, cprogramming, etc... | |
Re: >but when i run it it does not do the conversion You don't print the value of ch after the conversion. >#include<iostream.h> This is an old header that is no longer a part of the C++ language. Use <iostream> instead. You also need to consider namespaces, but for now simply … | |
Re: [B]>What i do not understand is what is going on with/after the second ::[/B] Work it from the inside out. iterator is a member of the vector<int> class, and vector<int> is a member of the std namespace. The idea is implemented as such: [code] namespace std { template <typename T> … | |
Re: The lexer turns source code into something that's easier to parse. That's really all there is to it. ;) | |
Re: [B]>The first question to ask is where do function prototypes belong? Not in main().[/B] Prototypes are not required to be at file scope. It's merely conventional because they usually reside in headers (which are usually placed at file scope) and used in multiple translation units. In the average case, prototypes … | |
Daniweb has an IRC channel, but how many people know that? How many people use it? Seven? Maybe eight? I think this is a sorely neglected corner of the community. | |
Re: [B]>try explaining me what to do or give me a code for example[/B] You could look at any of the open source libraries that do what you want for ideas on how to write your own implementation. [B]>don't redirect me to a site that already made a library for >this … | |
Re: [B]>// user is not allowed to create arrays with more than 10 symbols[/B] Okay. [B]>cin>>s;[/B] Oops, too late. There's nothing stopping the user from typing more than ten characters. You can check for a string length of ten or less, but by then any damage has already been done. You … | |
Re: [B]>Its urgent[/B] For future reference, stating that your problem is urgent will likely be counterproductive. A lot of us are perverse enough to ignore you solely because you're in a rush. Anyway, the immediate problem is your word counting logic isn't a part of the loop. That's not a very … |
The End.