6,741 Posted Topics

Member Avatar for kazmoney

First figure out how to count how many divisors are evenly divisible for single number. Once you have that, the solution presents itself as a variation of finding the maximum value in a set: [code] int main() { int most = 1; int val = 1; for ( int i …

Member Avatar for Narue
0
126
Member Avatar for knucklehead

>I wrote what I could in my program but now I'm stuck. You don't have any problems that a good book on C++ and a compiler wouldn't solve. >double main() I don't see this often. Usually the return type is either void or not present. I'll say this once, very …

Member Avatar for Narue
-1
145
Member Avatar for Tresa

>can anyone please tell me whether it is possible to make graphics work in borland c++? Yes, it's possible and there are several ways of going about it.

Member Avatar for Narue
0
119
Member Avatar for N3wbi3C0d3r

>just posting to bring it back up. Please don't do this, it's very rude. >If anyone can conjure up a HUGE project for me to do based on this tutorial Write a command line text editor such as [url=http://www.rt.com/man/ed.1.html]ed[/url].

Member Avatar for N3wbi3C0d3r
0
139
Member Avatar for JoBe

Can you be more specific as to what formulae you're talking about? Otherwise I'll just direct you to the mathematics section of your local bookstore.

Member Avatar for JoBe
0
399
Member Avatar for dcving

>while (Number1 >> 0) { "While the number is [b]much[/b] greater than zero"? :D;) A bitwise shift doesn't appear to be something you would want in this program.

Member Avatar for Narue
-1
115
Member Avatar for jifiii

When posting relatively long code compared to the tiny toy programs usually posted, it's best to include the exact error messages you get, and the comments on the lines that cause them if applicable. Here's your code with the requisite changes made to compile and link as C: [code] #include …

Member Avatar for Narue
0
130
Member Avatar for roodope

>Why am i getting ints as the output I want doubles??? I have no idea, but I'll admit that I didn't look very hard. Your code relies on files that I don't have, so proper testing is not possible. Why not strip the code down by hardcoding input values rather …

Member Avatar for Narue
-1
118
Member Avatar for usha

If both Process ID and Process Time have a common subset of operations that you can use from the array then you can have them as derived classes: [code] abstract class process_thingie { public abstract String get_thingie(); } class process_id extends process_thingie { private String id; public process_id ( String …

Member Avatar for usha
0
170
Member Avatar for skygod

You only work with strings explicitly in getNumerator and getDenominator, so those should be your first targets for debugging. I notice that you make a [b]lot[/b] of assumptions about the strings in question. indexOf can return -1, which would be a bad thing, and the input could be malformed, which …

Member Avatar for skygod
0
187
Member Avatar for jifiii

>how can I fix it to where it reads 16 bytes at a time. Without looking at the code: [code] char buffer[17]; ... fgets ( buffer, sizeof buffer, in ); [/code]

Member Avatar for Narue
0
191
Member Avatar for mdos

You can do it with templates, but it really isn't a better approach complexity-wise. The common method is to use the preprocessor with <climits>: [code] #include <climits> #include <iostream> #if INT_MAX != 2147483647 # error integers must be 32 bits long #endif int main ( void ) { std::cout<< INT_MAX …

Member Avatar for Narue
0
367
Member Avatar for sweety engineer

>A hash table is basically a linked list of linked lists An array of linked lists you mean. If the table is implemented as a linked list then the time required to traverse to the proper hash index would dominate search times and it's not much of an improvement. If …

Member Avatar for Dani
0
215
Member Avatar for anthmaina

>but am not understanding it.... Don't try to, it's wrong and will most likely give you an access violation at run-time. Dare I ask what book you got the code from?

Member Avatar for Narue
-1
132
Member Avatar for onsbomma

>I know this is not good code, but i was wondering They're both undefined, so your question can't be answered. Undefined means anything can happen, from nothing at all to the increased spin rate of any proton related to the change in state that is effected by your use of …

Member Avatar for Narue
0
132
Member Avatar for tushark

All object memory is allocated at either load time or run time, there really is no compile time allocation (technically there is, but not in the way that you're thinking) from an implementation standpoint. Can you be more specific as to what objects you're talking about when you say "function"?

Member Avatar for Chainsaw
0
126
Member Avatar for Alfy

>passing arg 1 of `fgets' from incompatible pointer type fgets expects a pointer to char. You pass it a pointer to int because buffer is defined as an array of int. Change buffer to be an array of char and the warning will go away. >should this be in my …

Member Avatar for Narue
0
147
Member Avatar for vegaseat

_gcvt is a Visual Studio function. sprintf should work fine provided you consider limit as the number of significant precision digits. >but the output looks rather crude to the perfectionist. How appropriately vague. Care to be more specific?

Member Avatar for vegaseat
0
301
Member Avatar for WrEcK

>undefined referrence to 'WinMain@16' You're compiling as a Win32 application, not a console application. But either way you would get an error as you haven't defined main at all, whether it be the C++ main or the Win32 API WinMain.

Member Avatar for Narue
0
96
Member Avatar for hopeolicious

>void run(); This is a function declaration, not a call. You need to call dvd's run member function: [code] int main() // void main is ALWAYS wrong! { char option; do { dvd.run(); // Get option // ... } while ( option != 'n' ); } [/code]

Member Avatar for Narue
0
168
Member Avatar for shantuli

>but it's not showing the 5th position. Your search only looks for the first occurance. To find subsequent matches, you need to continue the search until the end because you don't know how many matching items there are in the list: [code] public class Main { public static void main …

Member Avatar for Narue
0
149
Member Avatar for boshkash1986

>Please i want the code of the function which could get the serial number of the Hard-disk of any computer I want a paycheck every two weeks, but nobody just gives one to me without any effort on my part, even when I say "please".

Member Avatar for vegaseat
0
116
Member Avatar for neeraj
Re: oop

>what is the difference between structured & oop's ? One is structured and the other is object oriented. Do you want to ask a more specific question?

Member Avatar for Narue
0
64
Member Avatar for ze_viru$

>Pliz give me ideas. Ideas for what? What are you trying to do that you need help with? I'll assume that because '3' is not the scan code for Esc, you don't know what to test for. Try 27, if I remember correctly, that's Esc. If you search the boards …

Member Avatar for Narue
0
139
Member Avatar for jigvesh

Yes, it is possible. It isn't terribly difficult either if you're familiar with socket programming.

Member Avatar for alc6379
0
117
Member Avatar for galmca

>could any 1 reply plz............ I was going to help you, until I saw that you bumped your thread before 30 minutes had passed. That's incredibly rude. Try this: [Useful suggestion removed because you don't deserve it. Figure the solution out on your own]

Member Avatar for alc6379
0
352
Member Avatar for onsbomma

>IS this compiler specific or defined by the standard?? Only the interface is standard. How new and delete operate internally is up to the implementation. However, memory managers tend to be similar and you can make certain assumptions about the relationship between malloc/free and new/delete at the lowest level without …

Member Avatar for onsbomma
0
380
Member Avatar for ALT-F4

>I've been programming for sometime now and one thing I've never had to do is any sort of "debugging". You're incredibly lucky then to have never made any kind of mistake in your programs. Debugging is the process of removing an error whether it be compile-time, run-time, link-time, or a …

Member Avatar for ALT-F4
0
124
Member Avatar for HConn

Compare and contrast: >double findarea (double,double); >d=findarea(a,b); >double findarea (double q,double r,double s) { Be sure to take careful note that the declaration takes two arguments and the definition takes three. C++ treats these as two unique functions that are overloaded to have the same name, therefore the linker is …

Member Avatar for HConn
0
189
Member Avatar for see_moonlight

[code] #include <iostream> #include <string> #include <typeinfo> using namespace std; template <typename T> string typeof ( T arg ) { return typeid ( arg ).name(); } int main() { char ch = 'a'; cout<< typeof ( ch ) <<endl; } [/code]

Member Avatar for Narue
0
85
Member Avatar for Ginger

Never use gets. It's impossible to make gets safe. All you need to do is match declarations: [code] char strings[N][LENGTH]; ... void f ( char strings[N][LENGTH], int size ); [/code] Then it's just a matter of counting from 0 to size - 1 and using [b]fgets[/b] to fill strings[i] with …

Member Avatar for Narue
0
131
Member Avatar for phr0stbyt3

>so basically i just need a formula to figure out leap years If the following is true, the year is a leap year: year % 4 == 0 && year % 100 != 0 || year % 400 == 0. The test for modulo 4000 really isn't necessary because we …

Member Avatar for Narue
0
119
Member Avatar for StanVanDamn

Here is some pseudocode to swap two items in an array indexed by i and j. TYPE is whatever type of data are in the array. [code] TYPE save = a[i]; a[i] = a[j]; a[j] = save; [/code]

Member Avatar for Narue
0
141
Member Avatar for N3wbi3C0d3r

Using loops, draw the following shapes: [code] ***** ***** ***** ***** ***** [/code] [code] ***** * * * * * * ***** [/code] [code] * ** *** **** ***** [/code] [code] ***** **** *** ** * [/code] [code] * *** ***** ******* ********* [/code]

Member Avatar for N3wbi3C0d3r
0
313
Member Avatar for see_moonlight

I much prefer this one: [code] #include <cstring> static int is_valid_function_name(const char *function_name_string){ return std::strpbrk(function_name_string, "?/\\:*<>\"") == NULL; } [/code] ;) By the way, qualifiying a global name as static to give it internal linkage is a deprecated feature. If this was the original intent of the function--as opposed to …

Member Avatar for see_moonlight
0
156
Member Avatar for SureStoreX

Why not use the array as a sort of existence table. For example, you would have an array of boolean designating the number of seats: [code] boolean occupied[] = new boolean[N]; [/code] Now for each index i, i + 1 is the seat number. When the seat is occupied, set …

Member Avatar for SureStoreX
0
114
Member Avatar for mattcplusplus
Member Avatar for mattcplusplus
0
92
Member Avatar for PeterX

>but toString methode is just in class Car not in Class carTable. So define it for carTable.

Member Avatar for PeterX
0
102
Member Avatar for tionik06

>Its just this darn mod operator is so stubborn. When working with money, it's best to use integers because floating-point has accuracy issues. However, if you really want to use floating-point, the standard library supports the fmod function. fmod will perform modulus on two floating-point values.

Member Avatar for vegaseat
0
149
Member Avatar for zenah

>i need afull c++ programm of game called "pebble chess" Have fun writing it. :)

Member Avatar for alc6379
0
104
Member Avatar for mahas

>How about this.... How about not? By "improving" the code, you've broken it. Before, the Person class was a POD type and thus could be legally treated as a sequence of bytes (as stream.read does). And while performing a binary read into a class or struct type is immensely stupid …

Member Avatar for Narue
0
213
Member Avatar for dcving

>How do I get the highlighted lines below to center above the **************** Print a bunch of spaces before Hours: [code] cout<<" "<< Hours <<":"<< Mins <<":"<< Secs <<endl; [/code] >And why won't the program give me the total seconds after I entered the formula Amazing. Getting a decent question …

Member Avatar for N3wbi3C0d3r
0
196
Member Avatar for kimimaro

You have too many global variables for me to guess accurately what the problem is, but my first suggestion would be to make sure that your strings are terminated with a null character ('\0').

Member Avatar for Narue
0
96
Member Avatar for NicolaD

>if anyone can help please do so. I don't see a problem. Open the Java source file, read it line by line, and do a string search for the appropriate keywords. The result is a good start for your solution; you can refine the search from there on the off …

Member Avatar for Narue
0
148
Member Avatar for hill0ster

Strange values typically mean that you've forgotten to initialize a variable. This is the bug you should be searching for using print statements and a debugger if you have one.

Member Avatar for Chainsaw
0
94
Member Avatar for vrush

>so it's hard to critique A critique is not difficult at all: "Your code is crap, post something that actually uses C--not whatever it is you think is C--and we'll help." Simple. :)

Member Avatar for vrush
0
126
Member Avatar for Tejas

>I have been trying to get this for the past 2 weeks !! Do you have any code after these two weeks? >1)Delete all the occurunces of x; Removing an item from an array is an involved procedure. You need to shift all items after it to fill in the …

Member Avatar for cuperman
0
92
Member Avatar for abitlost

>Can anybody PLEASE provide me with some code No. I remember being grateful to people who gave me solutions when I was learning, but now I wish they hadn't because it hurt me more than it helped. That's why I'm a hard ass when it comes to solving your problems …

Member Avatar for Narue
0
113
Member Avatar for N3wbi3C0d3r

You can only have one main function. And if you bother to listen to people when they tell you to stop using iostream.h, you won't have to look at the warnings complaining about deprecated headers.

Member Avatar for Narue
0
172
Member Avatar for kakilang

>can someone explain to me what does below code do?? It simulates the Alt+Enter keystroke that puts an application into full screen mode.

Member Avatar for Narue
0
352

The End.