1,118 Posted Topics

Member Avatar for Koldsoul

What he means is don't use [inlinecode]cin >> myvar;[/inlinecode] alongside [inlinecode]cin.get( mystring );[/inlinecode] The problem comes because doing so breaks the user's input model. When you ask for something, the user types an answer and presses ENTER. The [B]get()[/B] method returns the string entered and tosses the ENTER away. The …

Member Avatar for Salem
0
104
Member Avatar for jaepi

That does sound odd. Can you post: 1. an example of the file 2. examples of what you are seeing in windows and in linux 3. the code you are using A cue file is a text file, no? Why are you using fread() instead of something like fgets()?

Member Avatar for ithelp
0
131
Member Avatar for Duki

Data structures are central to programming. (A C++ class is a data structure.) What level class is it? If it is lower than your C++ class then you might be able to skip it, but if it is only 100 or less points lower then you should consider it. All …

Member Avatar for Duoas
0
112
Member Avatar for Duki

An [B][I]overloaded[/I][/B] function is a function that shares its name with one or more other functions, but which has a different parameter list. The compiler chooses which function is desired based upon the arguments used. An [B][I]overridden[/I][/B] function is a method in a descendant class that has a different definition …

Member Avatar for Duki
0
6K
Member Avatar for Ratte

User supplied file names must be either absolute or relative to the application. If the file starts with '/' then it must be absolute. Otherwise, it is relative. Just tack it on to the end of the current working directory name, then collapse instances of "./" and "../". You didn't …

Member Avatar for Duoas
0
138
Member Avatar for guitarrick

Yes, your comment is absolutely right. Placing something at the beginning of the line will absolutely cause anything else on the line to be shifted rightward. Since your lines have fixed spaces fore and aft of each card, why not add a couple of spaces to the "header" line that …

Member Avatar for Duoas
0
98
Member Avatar for WillEthin

You need to pull out your textbook and look at some sample programs. Watch your syntax. Whenever a professor says "hint" that's a good place to start. I see you have one 2D array for the card values. You still need a 2D array for whether or not the card …

Member Avatar for Duoas
0
818
Member Avatar for nish88

Er, you misunderstand. We think it is the GIF that is faulty, not your code.

Member Avatar for woooee
0
304
Member Avatar for Ratte

Actually, you are doing things the Right Way. Five stars for you for using your head. Things are only temporary if you don't plan to use them long. In C++, you can pass things around easily enough and extend their life beyond normal even. [I]Local variables[/I] only live as long …

Member Avatar for Duoas
0
153
Member Avatar for Ccrobinson001

This is a math problem. You want to separate a number into hundreds. 141251 / 100 = 1412 R 51 and 1412 / 100 = 14 R 12 and 14 / 100 = 0 R 14 The C++ remainder operator is [B]%[/B]. Hope this helps.

Member Avatar for Ccrobinson001
0
97
Member Avatar for Garock

According to [URL="http://msdn2.microsoft.com/en-us/library/ms646302.aspx"]MSDN[/URL]: "This function is useful for input idle detection. However, GetLastInputInfo does not provide system-wide user input information across all running sessions. Rather, GetLastInputInfo provides session-specific user input information for only the session that invoked the function." Even if that were not so, you are trying to do …

Member Avatar for Garock
0
166
Member Avatar for Artmann

You most certainly [I]can[/I] return arrays from functions. Here are two ways to solve your problem. [code=Delphi] program u; {$APPTYPE CONSOLE} uses SysUtils; type tPerson = record name: string; age: integer; end; tPeople = array of tPerson; var people: tPeople; //procedure getPeople( var result: tPeople ); // Method 1 function …

Member Avatar for Artmann
0
1K
Member Avatar for sunrise2007

Use the [B]stringstream[/B] class: [code=C++] #include <iostream> #include <sstream> using namespace std; int main() { stringstream ss; string user_input_string; int user_input_int; cout << "Please enter a word and a whole number: "; cin >> user_input_string >> user_input_int; cin.ignore( 10000 ); ss << "The word is \"" << user_input_string << "\" …

Member Avatar for sunrise2007
0
158
Member Avatar for pukepuke

If you don't want the same random numbers over and over again, at the very beginning of your program, call the [B]randomize[/B] procedure. [code=Delphi] begin randomize; // init number generator from system clock ... end. [/code] As for the range, the problem is purely mathematical. If you have a list …

Member Avatar for Artmann
0
180
Member Avatar for people123

If you don't set [B]min_val[/B] and [B]max_val[/B] to [I]something[/I], it will be some random number to start --which may be lower or higher than any value in your array. So, if your array were [inlinecode]3 5 97 -2 12[/inlinecode] but [B]min_val[/B] were -349762, you'd have a problem. Both values [I]must[/I] …

Member Avatar for helixkod
0
94
Member Avatar for Zay

That's not a circular list, by the way, it is just a regular, forward-only linked list. What you've got there won't compile. When the compiler starts spitting out errors, look at the [I]first[/I] error and the line number it says. Go to that line and fix that error then try …

Member Avatar for Zay
0
146
Member Avatar for tracethepath

Er, before anything else, you really need to watch your I/O. Don't mix C++ and C. Find every [inlinecode]getch()[/inlinecode] (non-standard [I]evil![/I]) and replace it with [inlinecode]cin.get();[/inlinecode]. Find every [inlinecode]gets(s);[/inlinecode] and replace it with [inlinecode]getline( cin, s );[/inlinecode]. Also, I know everyone teaches and tutorials and etc. this, but try not …

Member Avatar for tracethepath
0
148
Member Avatar for ChaseVoid

The DJGPP is a 16-bit DOS compiler, and as such, will not likely keep up with the most recent C++ standards. Either get [URL="http://www.cygwin.com/"]Cygwin[/URL], which is a small Unix environment running under windows --it includes the most recent version of the GCC (gcc and g++ and a few other languages), …

Member Avatar for Duoas
0
304
Member Avatar for emilio

Don't forget that you'll have to [B]free()[/B] the array when you are done with it. [code=C] int *array_without_doubles = remove_doubles( array_with_doubles ); print_array( array_without_doubles ); free( array_without_doubles ); [/code] Good luck.

Member Avatar for Duoas
0
99
Member Avatar for LilLady

All these little things are important, but I think you need to spend more time thinking about how you are going to solve the problem. The computer is too stupid to do it, so you have to figure it out yourself first. I say this all the time but I …

Member Avatar for Duoas
1
144
Member Avatar for tu_m.aimes

SIGSEGV is a memory access violation --meaning that you tried to read (or write, but in your case read) memory that doesn't belong to you. The problem lies in lines 23 and 25. The condition at 23 is blissfully ignored by the loop at 25, which will continue until you …

Member Avatar for Duoas
0
155
Member Avatar for lalavoodoo15

You need to read up on how to [I]declare[/I] a function and how to [I]call[/I] a function. The function you are trying to use is [I]declared[/I] as: [inlinecode]bool hasaletter( string, char );[/inlinecode] To [I]use[/I] it: [inlinecode]if (hasaletter( "1024x768", 'x' )) cout << "It sure does...\n";[/inlinecode] Hope this helps.

Member Avatar for Duoas
0
72
Member Avatar for freakybeavis

While all true, I think your input paradigm is broken. [color=green][B]how you do it matters[/B][/color] Whenever you ask for input from the user what you expect him (or her) to do is type some number of characters and press the ENTER key. That's what [inlinecode]getline( cin, s );[/inlinecode] is for. …

Member Avatar for Duoas
0
2K
Member Avatar for deadswitch

A quick re-org to help: [code=C] #include<stdio.h> #include<stdlib.h> #include<string.h> // typedefs don't belong inside functions (not usually, anyway...) typedef struct { int room_num; char room_name[80]; char desc[1000]; int num_links; char direction1[6]; int dest1; char direction2[6]; int dest2; } roomStruct; // Functions need complete types void readRoom ( roomStruct rooms[] ); …

Member Avatar for Aia
0
139
Member Avatar for IzzoYourNizzo

1. [B]n[/B] is the number of elements in the array, where [B]k[/B] is 0, 1, 2, ..., n-1. 2. There is no need to calculate the average inside the loop. Move that stuff outside. 3. Don't forget to set [B]total[/B] to zero first, otherwise you'll just have some random number. …

Member Avatar for WaltP
0
128
Member Avatar for sullecy

No Pascal compiler is case-sensitive. Pascal is explicitly case-[I]in[/I]sensitive.

Member Avatar for Duoas
0
122
Member Avatar for picass0

[url]http://www.daniweb.com/forums/thread95939.html[/url] You really should do your own work.

Member Avatar for Narue
0
90
Member Avatar for Gorilatsouk1

Sed can do it easily. You'll have to get a little familiar with some simple regular expressions. [URL="http://www.grymoire.com/Unix/Sed.html#uh-8"]Here[/URL]'s a page with all kinds of useful information. Hope this helps.

Member Avatar for Gorilatsouk1
0
131
Member Avatar for jaepi

[quote]Is there anyway that you can convert the '\n' in windows which is 2bytes to the '\n' 1byte so that the linux could read it?[/quote] Sure. There is a little Unix utility called [B]dos2unix[/B]. It is found on most *nix systems. To do it in code, just set your output …

Member Avatar for vijayan121
0
167
Member Avatar for chico1st

MPLAB SIM is another proprietary, created for a textbook, simulated processor/language. I don't have access to it. Your best bet is to go get help from your professor. I don't think the code tags here understand assembly. I've tried a lot of different variations and none work... Good luck.

Member Avatar for Duoas
0
85
Member Avatar for helixkod

In OSX just open a command-line window and type [inlinecode]gcc[/inlinecode] or [inlinecode]g++[/inlinecode] to use the compiler. For example, if you have a program source file "palindrome.cpp" then type [inlinecode]g++ palindrome.cpp -o palindrome[/inlinecode] to compile the program. Type [inlinecode]palindrome[/inlinecode] to run the program. You must, of course, be in the same …

Member Avatar for vijayan121
0
177
Member Avatar for jadedreality

Perhaps you meant to post in the C forum? (This is C++.) Think about what the program is supposed to do, and [I]write down[/I] a sort of "how to" to get it done: 1. get an integer from the user 2. get another integer from the user 3. get yet …

Member Avatar for jadedreality
0
394
Member Avatar for Jacky1

No one here is going to give you code to do your homework. You need to think about the problem some bit more than you have so far, post [I]all[/I] the code you've got and any compiler errors or i/o errors, and then we'll help you fix it.

Member Avatar for Narue
0
101
Member Avatar for kiprono

You are going to have to write a global hook and use [B]SetWindowsHookEx[/B]. The procedure that does it will need to be compiled into a DLL (a regular application process is not permitted to use global hooks). Your application can then use the DLL to install the hook and remove …

Member Avatar for Duoas
0
80
Member Avatar for ashblynn02

(Thanks Ancient Dragon). In order to check whether an ASCII number is uppercase or lowercase you must decide whether it is greater-than (for lowercase) or less-than (for uppercase) a specific number. You must figure out what that number is. Pay attention on line 22: you test for equality when you …

Member Avatar for Duoas
0
5K
Member Avatar for wjyeo

Step by step. 1. Don't fflush(). There is no need and you shouldn't be mixing C and C++ I/O anyway. 2. You are mis-indexing the string: [inlinecode]01234[/inlinecode] [inlinecode]7+i3[/inlinecode] Hence, line[1] == '+' and line[4] == '\0'. BTW, [B]i[/B] never reaches 4 if your input is only four characters long. 3. …

Member Avatar for wjyeo
0
299
Member Avatar for lch07d
Member Avatar for ArrogantLegend

Why are you using [inlinecode]getline( cin, ... );[/inlinecode]? Don't. Also, your output doesn't quite match the required output... but otherwise everything works fine. Hope this helps.

Member Avatar for Duoas
0
131
Member Avatar for jaepi

No. I think it is a Solaris-specific extension. Do you think you will need to read or write files larger than 2GB?

Member Avatar for jaepi
0
2K
Member Avatar for jaepi

You are trying to do something like this: [code] for (int i = 0; i < 12; i++) { ... } if (i < 12) ... [/code] The variable [B]i[/B] is only supposed to exist inside the [B]for[/B] loop. The compiler is complaining about your using it outside the loop.

Member Avatar for vijayan121
0
131
Member Avatar for FireSBurnsmuP

I'm not sure exactly what you are trying to do. What exactly do you mean by "moves"? By "object" do you mean a raster color run (a horizontal line of the same color)? What is the purpose of doing this? The ppm format is as horribly inefficient as pbm, the …

Member Avatar for Duoas
0
195
Member Avatar for paradox814
Member Avatar for Duoas
0
333
Member Avatar for ITapprentice

What about [color=green][B]'till[/B][/color] (for [I]until[/I]) and [color=green][B]nothin'[/B][/color]? If those are also valid then your condition might easily be simply to check if the apostrophe is adjacent to a letter on [I]either[/I] the left [I]or[/I] the right. You are testing each character as you read it, so you will need two …

Member Avatar for Narue
0
217
Member Avatar for dblbac

The -- and ++ operators are initially confusing. They are unique to C and C++. What [inlinecode]--a[/inlinecode] means is "make [B]a[/B] = [B]a[/B] - 1 [I]before[/I] you do anything else." Same with [inlinecode]++a[/inlinecode]: [B]a[/B] is modified [I]first[/I]. The [inlinecode]a--[/inlinecode] means "make [B]a[/B] = [B]a[/B] -1 [I]after[/I] you do everything else." …

Member Avatar for dblbac
0
87
Member Avatar for piscean123
Member Avatar for Narue
0
147
Member Avatar for spankyg

A [B][I]handle[/I][/B] is a number used by Microsoft Windows to keep track of resources (like windows and memory and files, etc.). It has nothing to do with C++. So, if you know the handle of something you can call Win API functions that do something with the resource. To execute …

Member Avatar for Narue
0
129
Member Avatar for adrive

1. Yes. 2. No. Is this related to the other post you made? Word is not very good at reading all properly-formatted RTF. It likes and understands its own peculiar brand best, and can put-up with simple stuff from, say, wordpad and the like.

Member Avatar for adrive
0
75
Member Avatar for nshh

Somewhere, either in your code or in some library you are using, there is a reference to a function or a variable named 'hasp_login'. The linker can't find it. As for fixing it, can you give a little more information about where you are using it? If you didn't declare …

Member Avatar for tarekkkkk
0
205
Member Avatar for notathing

You've got an [I]off-by-one[/I] error. The elements of your array are numbered 0..299.

Member Avatar for Salem
0
74
Member Avatar for jamesny89

Your professor has done an extraordinary job of giving you concrete information to work with. Just take it one step at a time. Look through the functions he has asked you to write and pick the one you think will be easiest. Do it first. Work from easiest to hardest …

Member Avatar for Salem
0
160

The End.