Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Deceptikon is correct; text echo is a function of the shell itself, not of the stream I/O (which is the same basic model for both the C I/O functions and the C++ iostream classes). The standard C/C++ I/O operations don't know or care where the text comes from, as it always reads it from the input buffer regardless of whether it is from a console, a file, or a pipe. By the time the C/C++ operations even know that there is data to process, the shell operations have already been completed.

It is true that there are functions to communicate with the shell and turn echo on or off, but those functions are always system-specific (and in some cases, shell-specific), and not a part of the standard library.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

First, can you give us more detail as to what is going wrong? You say that it is running (which means that there are no syntax errors in the code - if there were, it would not have compiled), but that the results are incorrect, but how are they incorrect?

Second, I would say that there are issues with the way you have some of the variables defined, but that may simply be because I don't see the logic behind it. For example, is there a reason the vote counts are separate variables (can53_1, can53_2, etc.) rather than part of the candidate structure type? And why did you use floats for those counts - surely they will always be exact integral values, correct?

Third, while I usually recommend against using conio.h at all - it is not Standard C++, and really is specific to Turbo C++ (though some other compilers have equivalent libraries), which I also recommend against using wherever possible - if you are going to use any conio functions, why would you then use system() calls for operations which are supported directly by a function in conio, such as clearing the screen? For all its faults, the console functions are always going to be faster and more convenient than shelling out to the command interpreter.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

To engage in some more gratuitous thread necromancy, I thought I'd share a line from a .sig I use on the OS-Dev forums (with a more detailed explanation about it to be found in my user page on the wiki):

Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Given that this thread dates from a month ago, and that there seemed to be a definite time limit approaching when that post was written, I doubt that the OP is still having that particular issue at this point.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

mridul.ahuja: You, and the OP, need to be made aware that getch() (and the rest of conio.h) is not a standard C++ function, but rather is one specific to Turbo C++; some later compilers and IDEs have equivalents, but that doesn't change the basic fact that it will only work for DOS-based systems or their derivatives, and only with the specific libraries that support it.

That having been said, I should also add that Standard C++ has no support for raw console input; all standard C++ I/O is by means of buffered streams, and there are no ways to enter characters without displaying them, move the cursor around the screen or alter characters displayed on previous lines. All such operations are system-specifc; there are portable libraries to do this, such as ncurses. but not even those are universally available. If you know that you are going to be writing the program for a specific platform (e.g., Windows, Linux, MacOS), then the preferred approach is to use that system's native library.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I am at a loss to understand what you are trying to say. If you are 'not interested' in following the rules of the forum, I think you will find yourself banned by the moderators rather quickly. I'm not at all clear as to what the second sentence is meant to refer to; it simply makes no sense in this context.

As for not being American, most of the posters here are not, either, yet the rules apply to everybody. It has nothing to do with nationality, and everything to do with Daniweb's policies.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

dbfud1988: I know you meant well, but please do not just hand out code like this. Doing so goes against the 'no cheating' policy here at DaniWeb. We can assist and give advice, but we try to avoid simply answering homework assignments for students, as it interferes with the learning process. Tru,e there are borderline instances, and nearly everyone here has overstepped that line at some point or another, but this is a pretty clear-cut instance where providing code gratis is a Bad Thing.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Fon_1: Just to clarify the matter, are you looking for any C compiler, or specifically looking for an installation of the Dev-C++ Integrated Development Environment (which is not itself a compiler - the compiler it uses is the aforementioned GCC) and all of the additional libraries that go with it?

In the former case, I would recommend Pelles C as a good C compiler and IDE combination. It is specifically a C compiler, and unlike (say) GCC, it will not compile C++, but that may be just what you need. It includes a fairly complete set of libraries, though if you need a specific one that it doesn't include you may have some problems.

If it is the latter, then I recommend getting the Orwell Dev-C++ distribution; the older Bloodshed Dev-C++ version is a decade out of date. As for the packages that go with it, if you RTFM, you'll find that it includes a package manager that should allow you to download most of the tools you might want.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Actually, 'fault tolerance' has more to do with gracefully recovering from exceptional situations than with avoiding them entirely. Setting up exception blocks around fault-sensitive code (e.g., pretty much all I/O) is a good starting point, but not sufficient in and of itself; you have to know how to handle the exceptions, not just trap them.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Please make a separate thread for your question, as it is completely unrelated to both the original question and the post that revived the thread.

Also, when you do make a new thread, you'll need to have a much more specific question that the one you posted; this is far too broad a request for us to address as it is. You will need to give us a good deal more detail as to what you are trying to accomplish, including the purpose of the project (i.e., is it homework, a work assignment, etc.), how extensive a project it is (e.g., is this something that would actually be used by a real bank, or just a simulation of a bank system?), and what it is actually supposed to do.

Third, do not expect us to do you work for you. We are here to help new programmers to learn; doing your work for you only teaches you to cheat more. You will need to demonstrate to us that you have made a good-faith effort to solve the problem yourself, and ask intelligent and meaningful questions about the problem.

Fourth, I would recommend strongly against using Turbo C++, unless you are required to use it; it is over 25 years old, so the version of C++ it supports is outdated, and did not match the 'official' language even in its day. Similarly, the original Bloodshed Dev-C++ has not been updated in ten years, either; if you are going to use Dev-C++, …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Well in that case, if you are determined to try, far be it from me to discourage you, if only because you may find something no one else has yet. I would recommend you consider the difficulty what you intend to do long and hard, be prepared to do a great deal of research into prior art before you begin, and be ready to write it off as a learning experience when all is said and done. Learning is rarely a bad thing, after all.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

You said that you wanted it to be able to perform a search and retrieve relevant data from that search. That's the difficult part. Programs don't actually understand anything, at least not any programs currently in existence; sentience would be required for that. Current SOTA programs can fake it pretty well, but as I said, that's beyond even the best individual programmers to write on their own.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

These really aren't things an individual programmer - no matter how skilled - can accomplish on their own. While there are existing natural language, text-to-speech, and speech-to-text engines available, most of them are commercial libraries which have been developed over years or even decades by large teams of developers. You may be able to use one of these for the interface to your program, but then writing the program which interprets these for meaning is itself a major undertaking, and I know of no commercial or open source engines that provide such services - the response engines of programs like Siri or Watson are for the most part closely guarded trade secrets.

In any case, none of them are really intelligent or self-aware, and their limits are significant. This is an open research problem that may require solving the Hard AI Problem (that is, it may only be possible with a genuinely sentient intelligence equal to or greater than that of an intelligent human, something that may or may not be possible).

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

First off, do not commit thread necromancy; this thread had been dead for four years, until you ressurected it. If you have a new question, start a new thread.

Second, please avoid textspeak or other types of online abbreviations in this forum. Write clear, concise and grammatically correct English if you want people here to take you seriously.

Third, creating a Pig Latin encoder is a very different prospect from a natural language translator, so this isn't really the right thread for this in any case.

Finally, the kind of translator you are talking about is far, far beyond what even a talented individual programmer could achieve in a reasonable time frame; translators such as the Babelfish engine are the product of dozens if not hundreds of coders working for years, and even then they are invariably very limited in usefulness. Creating a truly effective translator is on open research problem, and may - not definitely, but nonetheless probably - require solving the Hard AI Problem to really make it work (that is, it may be only possible for a sentient program with human-equivalent or higher intelligence to translate the nuances of one natural language into another correctly and accurately).

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

First off, is this an open-source project, or one where the source is distributed for some other purpose? If you are distributing the program solely as binaries, then there is little reason to do this; editing compiled object code, even with a hex editor or a decompiler, is extremely difficult, and if they are able to do that, then obfuscating the code for the copyright notice will be the least of your concerns.

OTOH, if it is an open-source project, then obfuscating the copyright notice is counterproductive, as a) anyone altering it for any nefarious purposes will simply bypass that section of code if they are unable to understand it, and b) as the project administrator you should have the original code in source control (I should hope, at least), so restoring any changes should be a trivial matter.

Mind you, as long as you are the rightful creator of the code, and have documented this fact adequately for legal purposes, anyone changing the copyright notice will be in violation of copyright laws in any country that actually supports intellectual rights; and conversely, if it is in a nation that doesn't, you would have no legal recourse in any case, as the copyright would be meaningless there. It is true that there are several places around the world, in Eastern Europe especially, where intellectual property rights are legally in place but routinely go unenforced, but an outright violation like this is likely to be enforceable even there - if you …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

plzzzzzzz don't commit thread necromancy. If you need help, start a new thread.

That having been said, your question is too general, and isn't necessarily connected to the original post, which was about a specifc (and very, very, outdated) library that originally came with Turbo C++ for DOS. You will have to give us more information, starting with what operating system you are running under, what compiler or IDE you are using, and what library you mean to use if you have one already in mind. Standard C++ does not have any graphics support at all; it is a system-specific and/or library-specific function, so we'd have to know what you are programming for in order to help you.

Finally, this is a message board, not IRC or Twitter. You can and should post full messages, not a succession of short one-line posts.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

That was the one I was thinking it might be, but I was hoping the OP could confirm this.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Oh, I forgot to add that the graphics module you are using is not part of the Python standard library; I have a pretty good guess as to which one you are using, but I'm not certain. Do you know which it is?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

While I cannot be certain, it is likely due to a lack of scoping on the string declaration. The C++ standard string class resides in the std namespace, and you would need to scope the declaration accordingly:

            std::string number;

Alternately, if you expect to have a large number of string objects, you could bring the string class into scope throughout the file:

using std::string;

It is not recommended that you scope the entire namespace with using namespace std;, as this can lead to namespace conflicts. While the namespace-level scoping can be a convenience for small programs, it quickly becomes problematic, so it is best to avoid it unless you are certain it will not cause conflicts, and using in general should never be used in a header file, as it will cascade into any file that the header is included in.

Since you are using C++/CLI, rather than standard C++, you should also be aware that .Net Framework has its own String class, which is not compatible with the C++ standard string class. Most .Net functions expect a String, and won't work with a string.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

When posting any request for help with an assembly language problem, we ask that you provide some crucial information:

  • The operating system (Windows, Linux, MacOS, etc.) the program will be running under, including the version,
  • The assembler you are using, including the version,
  • the bit width being targetted (usually 8, 16, 32, or 64 bits), and
  • If you are using an emulator, and if so, which one and what architecture it targets

The reason this is important is that, unlike most of the other languages discussed on the DaniWeb, 'assembly language' is not a single, common, portable language, but rather a class of languages. An assembly language is primarily a human-readable analog for the machine operation codes (opcodes) of a particular processor family, and is specific to that type of processor. While the overwhelming majority of personal computers use some member of the x86 family, they are by no means the only type in use; most mobile phones and tablets, for example, use an ARM processor, which is entirely different from the x86 architecture.

Also, some processors have different bit widths in different models, or in different modes; for example, the original PC ran in a 16-bit 'real' mode, but later models of the x86 family introduced a 32-bit 'protected' mode, and later still, a 64-bit 'long' mode. Each of these modes have their own distinct ways of handling registers, data sizes, and so forth, so it is important to know what the word size is.

Furthermore, there are …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Well, they had been licensing the ARM architecture a few years ago, so it wouldn't be too big of a surprise if they did so again.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

OK, what have you tried so far?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

What happens when you try to run it?

(BTW, there seems to have been some kind of problem when you pasted the code, but don't worry, it isn't hard to see to tell what the code actually is. These things happen.)

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

In a post earlier today, I asserted that Intel wanted to get rid of the x86 platform. It occurred to me that a lot of folks may not understand this claim, but there are good reasons for it. They have made at least three attempts at doing so, in fact, starting as early as 1986, but the momentum of the existing hardware and software base has made it impossible for them so far.

Why would Intel want to kill the goose that laid the golden egg? Simple: it isn't the cash cow most people think it is. Most of their real business isn't in the desktop systems, it's in embedded systems (including mobile systems, these days), and they never intended to get into the small computer market in the first place. In 1977, when they first began designing the 8086, the home computer market was tiny, the reserve of crazy electronics enthusiasts who mostly built their own systems from kits (there were a handful of pre-built systems on the market, but even those were mostly seen as a novelty). That market was too problematic and too small for them to waste much time on; as far as they were concerned, they were making microcontrollers, thank you very much, and this whole business of 'microcomputers' was a passing fad. It probably would have been a fad, if Apple hadn't come along, but even then Intel wasn't very interested, as Apple was buying their microprocessors from a competitor. It wasn't until IBM …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Actually, this is what I believe is now called 'C++ for .Net Applications', what used to be called 'Managed C++' (or as I always preferred, 'Mangled C++'). It is a dialect created by Microsoft and specific to their systems, which runs on the .Net CLR. It is really a new language, distinct from standard C++, but MS never wanted to admit this as it would put off those who didn't want to work with .Net (and to silently lock client-programmers into their non-standard dialect without them realizing it). It exists primarily because they were never able to move all the system operations to .Net as they originally planned, and so continued to need ways to mix .Net code with native code (as I understand things, their real goal in creating .Net was to give the x86 platform the heave-ho - something nearly everyone, including Intel, would like to do - by making Windows itself run in the .Net pseudo-machine a la the old UCSD Pascal OS, but it never came close to working since it would mean losing the entire backwards compatibility structure that Windows' success is built upon, and the goal was eventually abandoned).

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Unfortunately, Objective-C - a higher level language comparable to C++, but more directly influenced by Smalltalk, and used primarily on MacOS and iOS systems - is actually quite a different thing from Kiel Embedded-C (which is a C dialect specifically intended for microcontroller programming architecture), which is what I believe you are looking for help with. Aside from the fact that you would want the C forum rather than the Objective-C forum, it is unlikely that anyone here is familiar with the specific dialect in question. You may want to try to find a forum specific to Embedded-C, if you haven't already. I assume that's what you were looking for when you came here, but I'm afraid it isn't at all the same.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Well, in that case, you have come to the wrong place; no one here is going to do your homework for you. We will give advice, help and comiseration, but we won't help you cheat.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

What kind of help do you need?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

/me covers ears from the shouting

As Moschops said, it depends on the operating system, on the C compiler and libraries you are using, and in some cases, the specific type of console you are working with. I'm going to guess that you are working with a DOS console running under Windows, possibly in a DOS emulator such as Dosbox. I'll further speculate that you are using Turbo C or Turbo C++, since hardly anyone working with modern tools is going to be interested in doing this. Is this a fair assumption?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

OK, rather than getting caught up in the details of the specific matter, let's talk basic principles for a bit.

The main purpose of inheritance is to allow common elements of two or more classes to be defined in a way that the child classes can share what is defined in the parent class. Let's say you have a class Vehicle, which defines - without regard to the mechanism - a method move(). Now, if you want a class Automobile that describes the properties and behaviors of a car, you need not define an entirely new class; you can inherit most of what you need from Vehicle, including the move() method. You can override the existing move() method or not, depending on how you want it to behave. You can also add new methods, such as brake(), to extend the abilities of an Automobile beyond those of the parent Vehicle class.

Now, here's the important part in regards to your question: since an Automobile is an instance of a Vehicle (given our definition of Automobile), you can have any Vehicle instance hold an Automobile as a kind of Vehicle. Because it is a Vehicle, any method that is common to all Vehicles can be applied to the variable, including move(), and it will correctly use the version of the method for the actual object's class. In other words, even though it is a Vehicle variable, since the object is an Automobile, it will use the move() for an Automobile, if …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Pseudo-code doesn't work; that's the whole point of it. It is a higher-level description of a problem without the details that would make it a running program. Pseudo-code isn't a specific language - it is just a description of the program in a way that resembles actual code, but omits the details. There is no specific syntax or rules for pseudo-code, you make it up as you go along.

If you don't mind me asking, why do you need pseudo-code for a program that already exists? Usually one writes the pseudo-code first, and then uses that as the design for the actual program, not the other way around. Did you assignment call for you to lay out a design in pseudo-code, and then write the program? If so, how did you come to skip that step?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I apologize for having hurt your feelings; as I said, I was pretty sure you hadn't meant it that way, but it can be hard to tell sometimes. We do get a lot of people who are asking for their work to be done for them, so there's a bit of a tendency to assume the worst. I am sorry for doing that to you.

As for displaying the names of the files... well, we'd need more information about just what you are trying to do. If it were simply a matter of displaying the names of the files used during the current run of the program, it would be very simple: you could simply keep a vector<string> of the file names that have been entered, and print the strings in a loop (vector is a template class which acts as an array that can automatically grow or shrink as you need it to). However, I am assuming you want to be able to get the files that the program has previously generated, which presents a few problems.

First off, you would have to know where the files in question are, either by checking the current working path, or by having some directory where you can look for them, or by letting the user choose where they should be stored. You would also want to have some way of telling which files are the data files for this program, which usually means picking a file extension for them.

But that's …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

CSprogA: While I would have worded it rather differently, I have to agree with Hassan_12 on this. You would have to tell us what help you need, and ask meaningful questions about how you can solve the problems you are having, before we can have any hope of helping you in a way that wouldn't constitute a hand-out. While I am pretty sure that you honestly did come for advice rather than a quick fix, given some of what you said, it did come off as begging rather than a serious request. Try to explain what the problems you are having in more detail, if nothing else.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

If you check the dates, you would see that this thread is four years old, and that Krysis has not been on Daniweb since then.

Please avoid thread necromancy in the future, thank you.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

No, what you need is to read the Daniweb Forum Rules, specifically this one:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

We are perfectly willing to help you, if you ask a meaningful question, and will do our best to assist you in fixing problems with code you post here. However, you need to show that you have made a good faith effort to solve the problem on your own before posting about it here.

In this case, if you really aren't certain where to start, ask a pertinent question rather than simply demanding a handout. Oh, and search the forum archives as well; there are dozens if not hundreds of examples of linked list implementations on this site already, and one of them ought to be enough to give you a leg up.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

goold: Hijacking a thread with an unrelated question is rude. Hijacking a thread to make the exact same mistake that the OP was criticized for is simply stupid. DON'T BE STUPID.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I think you have the wrong forum; this one is dedicated to helping programmers learn how to improve their craft, not a hiring forum. Try the 'Jobs & Resumes' message board under 'Business Exchange' in the top menu, or a hiring site such as freelancer.com.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

No one here will do your homework for you. Please demonstrate that you have at least tried to solve the problem first prior to posting here.

<rant>
Seriously? This is beyond trivial. If you had been paying attention in class at all, or even opened your textbook just once, you could have completed this assignment in less time than it took to post this question. This is laziness of the worst kind, and we at Daniweb aren't going to reward you for it.
</rant>

Sorry for the rant, but I am not kidding - this should take even a rank novice programmer less than five minutes to complete using just paper and pencil. You have wasted both our time and yours by bringing this here.

rubberman commented: Well put! Some students can't do the work without looking over the shoulder of better students... +13
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Thomas_25: rubberman and deceptikon have, indirectly, brought up a good point: is a doubly linked list what you actually need for your purposes, or would an ordered tree structure of some kind (e.g., a priority queue, an AVL tree, a splay tree) serve your needs better? Now, obviously, if this is for a homework assignment on doubly-linked lists, there's not going to be any leeway in this regard, but otherwise, you might want to consider just what data structure fits the problem best. What is the project you are looking to apply this to?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I am guessing that you used the built-in float type for this, but given that you are dealing with currency, I would recommend using the decimal module for representing the monetary value instead, to get the best control over the significant decimal places, and applying locale.currency() to format the value as a string. While the links I posted are for the Python 3.4 docs, thhis should apply to Python 2.7 as well.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

suraiyaparveen: You won't get it, for two reasons. First, no such program exists - those are all things that need to be done manually, not programs to be written. Second, even if it were feasible to do those things programmatically, we wouldn't give it to you without some evidence that you had put in a good faith effort to solve the problems on your own first. Daniweb is not a free homework cheating service, and no one here is going to do your work for you.

Also, don't go reviving long-dead threads. Thread necromancy is considered extremely rude on pretty much every message board on the web, and is just one more reason for most of the people here to ignore you or worse.

rubberman commented: Ah! Digital necromancy! Time to raise the long dead! +0
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

I've ended up pulling this boilerplate reply out twice in 24 hours, sheesh

First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet?

No one here will simply hand you a solution on a silver platter. If you show us what you've done, what you've tried to do, and what problems you've had with it, then we'll be happy to help. If you have specific questions, we can answer them, or at least point you in the right direction. If you have a program with a bug you can't swat on your own, we'll be glad to assist, so long as you pay attention to the forum rules and post sensible questions in an intelligent manner that we have some reasonable hope of answering.

But just demanding that we provide you with code with no evidence of any effort on your part is likely to get you booted from the message boards here and elsewhere - if you're lucky. What happens to you if you are unlucky is... well... let's just say that this guy probably won't be trying that again, on that forum or this one.

We take this issue seriously here. Very seriously. Asking us to do homework for you is a grave breach of academic ethics on your part, and actually doing so would be …

rubberman commented: Remedial basket weaving? :-) A great course as I recall! +0
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Before I get to my answers, let me ask you a question: what is your purpose in accessing dev/urandom? Is this for a class assignment, or part of a larger project? Is there a specific reason why the usual srand()/rand() functions aren't sufficient? What are your goals in doing this?

OK, now that that is out of the way, here goes. The first thing to know is that /dev/urandom (and the files in the /dev directory in general) isn't actually a file at all; it is a pseudo-device, a sort of handle for accessing the kernel pseudo-random number generator in this case.

To read either /dev/random or /dev/urandom, you need to read in a block of one or more bytes (type char is usually used, though using uint8_t might make it more easily understood that the buffer is being used for it's numeric value), which you would then pack into the integer either by using shifts, or by having the buffer as a union of two overlapping buffers:

#define INT_BUF 32 
#define BYTE_BUF (sizeof(int) * INT_BUF);

union 
{
    uint8_t buffer[BYTE_BUF];
    int rand_values[INT_BUF];
} random_buffer;

This StackOverflow thread explains how to read from /dev/urandom effectively, including why you might want to read several values at once. Note that in one of the later answers, it is explained that you ought to check to make sure that dev/urandom hasn't been spoofed to /dev/zero or something similar before reading from it.

The difference between dev/random and /dev/urandom is that …

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

Now then, to repeat rubberman's question: what problem are you actually having with this code, and where is it occurring?

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

For the sake of readability, let's start by separating the class declarations and implementations from the main program, and get the whole into some semblance of a consistent indentation:

matrix-list.h

#ifndef MATRIX_LIST_H
#define MATRIX_LIST_H 1

class Node
{
private:
    int row;      // different data type for other apps
    int column;
    int value;
    Node *next;   // the link pointer to next item

public: 
    Node(int x=0,int y=0,int z=0,Node * ptr=NULL); // constructor
    int getRow();
    int getColumn();
    int getValue();
    Node *getNext();
    void setValue(int z);
    void setNext(Node *ptr);
};

class List
{
private:
    Node *head_ptr;
    Node *tail_ptr;
    int numOfItems;

public: 
    List();               // constructor
    int size( );  
    Node *getHead( );  
    Node *getTail( );
    bool isEmpty( );
    Node *itemAt(int position);
    void removeHead(); 
    void removeTail(); 
    void insertHead(int x, int y, int z);     
    void printList();
};

#endif

matrix-list.cpp

#include <iostream>
#include "matrix-list.h"

Node::Node(int x, int y, int z, Node *p):
    row(x), column(y), value(z), next(p)
{
    return;
}

int Node::getRow()
{
    return row;
}

int Node::getColumn()
{
    return column;
}

int Node::getValue()
{
    return value;
}

Node * Node::getNext()
{
    return next;
}
void Node::setValue(int z)
{
    value = z;
}

void Node::setNext(Node *ptr) {next=ptr;};


List::List()
{
    head_ptr= NULL;
    tail_ptr=NULL;
    numOfItems=0;
}

int List::size()
{
    return numOfItems;
}

Node * List::getHead()
{
    return head_ptr;
}

Node * List::getTail()
{
    return tail_ptr;
}

bool List::isEmpty()
{
    return (numOfItems==0);
}

Node *List::itemAt(int position)
{
    if (position < 0 || position >= numOfItems) 
        return NULL;
    Node * currentPtr = getHead( );
    for(int k=0; k != position; k++)
        currentPtr = …
rubberman commented: Schol-R-Lea, you are much more patient that I am! +13
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

IMAO, the best approach to sorting a linked list is not to let it get out of order in the first place. While inserting the nodes in order is slower than pushing them to the head of the list and then sorting, it has the affect of amortizing the sorting over the course of the program's operation, which can prove more important than sheer operational speed. More importantly, it means that there is never any need to repeat the sorting, which is often the case if the list is being actively changed over time.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet?

No one here will simply hand you a solution on a silver platter. If you show us what you've done, what you've tried to do, and what problems you've had with it, then we'll be happy to help. If you have specific questions, we can answer them, or at least point you in the right direction. If you have a program with a bug you can't swat on your own, we'll be glad to assist, so long as you pay attention to the forum rules and post sensible questions in an intelligent manner that we have some reasonable hope of answering.

But just cutting and pasting an assignment into a message, without even prefacing it with something like, "I have this homework problem that I can't solve...", is likely to get you booted from the message boards here and elsewhere - if you're lucky. What happens to you if you are unlucky is... well... let's just say that this guy probably won't be trying that again, on that forum or this one.

We take this issue seriously here. Very seriously. Asking us to do homework for you is a grave breach of academic ethics on your part, and actually doing so would be an even bigger breach on …

rubberman commented: Good rant! :-) +13
Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

No, the DBMS is the SQL library or process that the application interfaces with to manipulate the database. For example, MySQL is a DBMS, but an application that uses MySQL would not be.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

how can i make a calculator using function and procedure..

With all due respect, this is far too broad a question for us to try to answer, even if we were inclined to do the work for you in the first place - which we are not. NathanOliver's answer is about the most any of us can give without a lot more details about what you need to do, and a lot more evidence that you have tried to solve the problem yourself.

Whatr specifically do you need help with? If you are having trouble understanding how functions work, there are plenty of older posts on the subject here; a search should turn up dozens.

Schol-R-LEA 1,446 Commie Mutant Traitor Featured Poster

The elaborate on DaveAmour's answer, you should know that C (the predecessor of C++) does not have a built-in boolean datatype, and until the C99 standard didn't have a standard defined one either. Thus, it has long been the convention in C to use int variables as booleans, with 0 for false and any other value for true.

While C++ has always had a bool type, a lot of C++ programmers who had started out in C never got into the habit of using it, and a lot of C programs which were converted to C++ were never changed to use it, either.

The variable name flag (or some variation thereof) generally indicates that the variable is being used as a boolean value, and more specifically, a flag value, that is, one used to indicate a particular state or state change in the program. In file formats, an int value may actually hold several packed flag fields, with the individual bits being treated as separate boolean values. However, in the context you are describing, it is more typical for it to hold just a single boolean value.