6,741 Posted Topics
Re: It's certainly possible, how do you think the operating system itself works? ;) However, without the aid of an OS, you might find yourself writing a lot of plumbing to work directly with the hardware. | |
Re: [QUOTE]Now, would this work?[/QUOTE] What an odd question. Why don't you write up a quick test to see if it works? If it does, then try to break it with pathological cases. | |
Re: 0xabababab looks like debugger fluff for an uninitialized pointer. | |
Re: If you use a console application, that will use the console subsystem. If you use a windows (win32) application, a console won't be created for you and your GUI will load alone. I don't recall off the top of my head if Code::Blocks has win32 project templates, sorry. | |
Re: >People did any of you come across good tutorials on hash tables??? No, I never came across a good tutorial on hash tables. So I [url=http://www.eternallyconfuzzled.com/brain.html]wrote one[/url]. :) | |
Re: [QUOTE]is that allowed?[/QUOTE] It's usually wise to ask that question [i]before[/i] starting your thread and having it shot down with an infraction. And no, as the infraction PM you received clearly states, advertising your services constitutes spam. | |
Re: [QUOTE=pseudorandom21;1579352]Not to promote the use of alcohol, but it is in most places legal at least. Well I turned 21 a few months ago, so I'm wondering what everyone else drinks when relaxing on their off days? I like: Miller Lite Bud Light Other non-traditional (non-mass-produced) beers like dos equis, … | |
Re: [QUOTE]Is it even possible to create a singly linked list using a function outside of main and then access it once you leave the function?[/QUOTE] Um, yes. If that weren't possible, linked lists in C would be rather useless, no? [code] #include <stdio.h> #include <stdlib.h> struct node { int data; … | |
Re: [QUOTE=coril;1626152]By error, I should have been more specific, it compiles but when it runs, it doesn't work as intended (skips the next scanf()). getchar() also solves the problem.[/QUOTE] Which doesn't invalidate the advice to avoid calling fflush() on input streams. getchar() solves the problem as well, but you might consider … | |
Re: You can start [url=http://msdn.microsoft.com/en-us/library/aa364963(v=vs.85).aspx]here[/url]. | |
Re: Barring an off-by-one error in your array indexing, it works fine on my end. | |
Re: [QUOTE]cuz worst case it requires n swaps for each of the n elements[/QUOTE] How do you figure that? | |
Re: What's the purpose of this program? Knowing the use cases can help greatly in figuring out what strategies would work best for locking down functionality. | |
Re: [QUOTE]I'm not trying to write a computer virus, or trying to learn how to crack software illegally![/QUOTE] That may not be [I]your[/I] intention, but this is a public forum. How can you guarantee that what you learn in this thread can't be taken by others and used for malicious purposes? … | |
Re: [QUOTE]Yes, the obvious answer is, "take as much of the most valuable powder as he can"; yes, but how do you determine that, mathematically?[/QUOTE] Is there a variable for powder value, or are you simply using size? | |
Re: Can you post a more complete example that still throws your error? | |
Re: Parse errors can be confusing, but if you posted your code exactly as it is, the declaration of open_file() in your header is missing a semicolon at the end. Since headers are textually inserted into the translation unit, this [code] #include "functions.h" int open_file(int argc, char argv[], int count) { … | |
Re: [QUOTE][CODE]num = atoi(word.c_str());[/CODE][/QUOTE] I realize you didn't compile or test, but atoi() is declared in <cstdlib>, and it's in the std namespace. I assume you're using Visual Studio because it's pretty lenient about requiring namespace qualification on the C-inherited library. On a side note, atoi() is evil. Unless you validate … | |
Re: [QUOTE=Marvin Danni;1624153][CODE]#include <iostream> #include <string> using namespace std; int main(){ string str = "Gregory"; int k = 0; for (k=0; str[k]!='\0';k++){ if (str[k]>=65 && str[k]<=90) { str[k]+=32; } } cout << str << endl; } [/CODE] is this code right[/QUOTE] No. Ignoring your assumptions about the character set, std::string is … | |
Re: [QUOTE]Is "ip is a pointer to int" (the type) or is "ip a pointer to an int" (a particular variable of type int)?[/QUOTE] If you want to get specific, "ip is an object with the type pointer to int". An object has a type. The object is a concrete entity … | |
Re: [QUOTE]looks like c could make generic programming come true but it could be very tedious[/QUOTE] Not to mention type unsafe, which you can assign evilness to according to your beliefs about type safety. ;) [QUOTE]and much more harder to maintain than template[/QUOTE] Clearly, which is why templates were added to … | |
Re: [QUOTE=HASHMI007;1618988][code] #include<stdio.h> #include<conio.h> void main() { clrscr(); char name[50]; int i,j; printf("Enter Name : "); scanf("%s",name); printf("\n%s",name); getch(); } [/code][/QUOTE] And the point of this post is what exactly? You completely failed to answer the question, or solve the stated problem, and you didn't fix any of the other problems … ![]() | |
Re: [QUOTE]Couldnt this have been made much simpler if[...][/QUOTE] Yes, it could have. But like many features with the label "nice to have", the critical mass necessary to get it into the language specification wasn't ever reached. You might find a compiler that supports something along these lines as an extension … | |
Re: [QUOTE]Since its the same file, we dont have to do a #include"samefile.h"[/QUOTE] Since headers provide declarations, and the extern declaration already does that, including a header at all is unnecessary. You can still have two files: [code] /* foo.c */ int a = 20; [/code] [code] /* main.c */ #include … | |
Re: [QUOTE]I want the child class to overide it such that when the parent calls setupBuffer() it calls the child's version. Should either be virtual?[/QUOTE] If you're overriding a parent class member function's behavior in a child class, it should probably be virtual. [QUOTE]Another situation is when I want the child … | |
Re: [code] #include <iostream> #include <sstream> #include <string> int main() { std::string filename = "myfile_"; for (int i = 1; i < 10; i++) { std::ostringstream oss; oss << filename << i; std::cout << oss.str() << '\n'; } } [/code] Edit: My bad, I didn't realize this was the C forum. … | |
Re: Given an array [ICODE]a[M][N][/ICODE], [ICODE]a[i][j][/ICODE] is logically equivalent to [ICODE]a[i * N + j][/ICODE] if the dimensions are stored in sequence. | |
Re: You're entering the realm of concurrency. For example, you might create one thread to handle user input while another handles the timer. | |
Re: Did you include ? Do you have a using directive for std using namespace std; or a using declaration for each standard name using std::cout; using std::cin; at appropriate locations? | |
Re: [QUOTE]is it possible to have a back() in stack....i know queue and vector has it...[/QUOTE] For the standard container adapter, no. Check any reference and you'll see that the exposed non-boilerplate methods are push(), pop(), top(), and empty(). However, std::stack is an adapter for an existing container (the default is … | |
Re: Sorry dude, but we're not sympathetic toward people who go through N years of school and still can't come up with a something as trivial as a [i]topic name[/i]. One has to work really hard to be that helpless. | |
Re: I may start just deleting posts that fail to use code tags. :@ | |
Re: [QUOTE]1- what is the difference between web developer and web coder ?[/QUOTE] Terminology. [QUOTE]2- should a web developer study computer science deeply , before starting a career & why?[/QUOTE] Why wouldn't they? Sure, web developers are sometimes viewed as short bus window lickers compared to applications developers or systems developers … | |
Re: [QUOTE]Anybody have experience in learning from video tutorials?[/QUOTE] I haven't seen any that were worth a damn. | |
Re: When it comes to alignment, just play with the different setw() values until you get what you want. Alternatively, you could show the votes horizontally instead of vertically. That simplifies a lot of things. | |
Re: [QUOTE]The "new" doesn't execute until absolutely necessary.[/QUOTE] That would be difficult to implement in any useful manner. Perhaps you're thinking of lazy initialized objects? That has the behavior you're talking about, but it's a part of the class implementation rather than the compiler. | |
Re: [QUOTE]without using predefined macros[/QUOTE] What is with you people asking a question and then immediately rejecting the best solution? What do you think the __LINE__ macro was designed for? | |
Re: [URL="http://catb.org/~esr/faqs/smart-questions.html"]How To Ask Questions The Smart Way[/URL]. | |
Re: The good news is that your case is pretty trivial because firefox supports command line arguments. So you can simply invoke a command line string: [code] #include <cstdlib> std::system("firefox.exe \"http://www.daniweb.com\""); [/code] | |
Re: [QUOTE]The problem is, when I try to DELETE PERSONAL PROFILE. I can delete it but the PROFILE number still there. I want it to be deleted also when I delete the data.[/QUOTE] You need to do one of two things to truly erase the data: [list] [*]Overwrite the record in … | |
Re: [QUOTE]If someone request a B than I'm supposed to print a C. If someone request a C I print D.[/QUOTE] What a cynical design. So you'll always assume that the student is lying to get a better grade, always deserves a lower grade, and an A will never be given? … | |
Re: [QUOTE]So what you're saying is you defined d as a global variable of some indeterminate type[/QUOTE] Though there's a good enough chance of it being [ICODE]struct tm[/ICODE] that you can safely make that assumption rather than acting like a pedantic douche. ;) [QUOTE]changing gets() to gets_s() is a bandaid rather … | |
Re: What you probably want to do is accept any character in the loop, but only print it if it matches the criteria: [code] while (cin >> letter) { if (is_vowel(letter)) cout << letter; } [/code] Obviously this is a non-working example that you would need to flesh out (such as … | |
Re: I'm somewhat confused about this design. Why make CWorker's constructor a friend of CCar when you can simply construct a new CCar? [code] #define LEN_N_W 20 class CWorker { char m_name[LEN_N_W]; CCar m_Car; public: CWorker(const char *name, const char *firma = "",int price = 0); void showWorker(ostream& out)const; }; CWorker::CWorker(const … | |
Re: [code] if (!(cin >> num)) cerr << "INVALID INPUT\n"; [/code] | |
Re: If I'm reading your post correctly, you want to change how the watch window in your IDE shows arrays? I'll go out on a limb and say that you're SOL unless you want to write a plugin to alter the behavior. | |
|
The End.