1,362 Posted Topics

Member Avatar for akansha.jain.526438

Determine which column to sort on. Sort as you would a 1D array. Make sure you keep all the items in a row together when you do the exchanges.

Member Avatar for vmanes
0
45
Member Avatar for guilherme.carvalho.9250

The modulus operator's role is to return the remainder (leftover) from integer division. For example, 17 / 5 gives a quotient of 3. What about the remainder, 2? That we can get with modulus. 17 % 5 gives 2. When a number divides fully into another, modulus gives a value …

Member Avatar for guilherme.carvalho.9250
0
197
Member Avatar for loldafuq

Line 95, you test i < k. What value is k? Since it is unitialized, there is no knowing how many iterations of the loop will occur, probably going past the end of valid data in the array. Are you looking for the oldest girl or youngest girl. Your naming …

Member Avatar for abd.mosaher
0
135
Member Avatar for marnun

Or better, move the return statement to end of the function so that the .close() will be executed as well.

Member Avatar for marnun
0
265
Member Avatar for Sasquadge

Another technique is use the fact that the colon separates the fields, using it as a delimiter in the getline. This separates the items for you. std::string input; while( getline( infile, input, ':' ) //reads first element of record { //output the first item getline( infile, input, ':' ); //read …

Member Avatar for Super_android
0
174
Member Avatar for rodrigo.l.salazar.14

The statements at lines 21 and 23 don't do anything. You need to assign the value in a[i] to one or the other of the two target arrays. Also, don't test i for odd or even, test the value at a[i]. Lastly, you can't use i as the index into …

Member Avatar for vmanes
0
181
Member Avatar for jlillie

The problem with the hand value is that when you shuffle the deck, you initialize the face cards to values 11-13, which you need to distinguish what they are. But when you use them to add up a score, you must use value 10. So you need to disginguish between …

Member Avatar for vmanes
0
166
Member Avatar for haidang.nguyen

The code above works fine for me in Visual C++ 2010. You might try a `infile.clear( );` before you attempt to open the file again inside the loop.

Member Avatar for deceptikon
0
162
Member Avatar for fishsticks1907

After you read in the grades with the extraction operator ( >> ), a newline is left on the input stream. When you then use getline again, it sees the newline and quits. You need to remove that newline. Perhaps file.ignore( 10, '\n' ); This will throw away up to …

Member Avatar for vmanes
0
228
Member Avatar for vmanes

This is for the more experienced folks. Recently I found that in Visual C++ 2010 (and 2012, not sure about earlier versions) one can use a std::string as the file name argument for the .open( ) function. I've always known the .open( ) function to take only char* (C-style) strings …

Member Avatar for NathanOliver
0
1K
Member Avatar for pjh-10

In VC++ 2010 it compiles and runs. Do you have some sample input and the corresponding output you expect? gazzatav: The use of the command line arguments for main are optional. If your program doesn't expect arguments, you need not enter them in your code. It is not a compiler …

Member Avatar for gazzatav
0
162
Member Avatar for Hey90

Can you show more code, such as where you actually call the function? It looks like you're trying to pass a single Shoe object as the actual argument, rather than the array of Shoes

Member Avatar for Hey90
0
187
Member Avatar for Rachel Ard

To know how many seats are available in each row, you need to use the same loop structure you have in the DisplaySeats( ) function to count up the number of seats marked available as you loop through each row. Be sure to reset your counter to 0 as you …

Member Avatar for vmanes
0
192
Member Avatar for Slate2006

You are asking two different questions. To find the length of an array (the amount of storage allocated to it), you can use the sizeof( ) operator, but only in the function where the array was allocated. As in: [code] int arr[] = { 1, 2, 3, 4, 5, 6 …

Member Avatar for Sebelius
0
1K
Member Avatar for GrimJack

You know you are old when you read all these "you know you are old when" posts and think, "What are these young whippersnappers talking about?"

Member Avatar for vinnitro
1
3K
Member Avatar for SEOvB

That sounds like the drive mechanism is damaged. If so, not much an end user can do. If you google: "hard drive recovery service" you'll find many outfits that can recover your data. It's a matter of how much it's worth to you. Consider that [URL="http://www.ontrackdatarecovery.com/"]OnTrack [/URL]was able to recover …

Member Avatar for JANINE
0
166
Member Avatar for sillyboy

Whatever's playing on [URL="http://www.offshoremusicradio.com/"]Offshore Music Radio[/URL] via its iTunes radio channel. Reliving the days of Radio Caroline and her sister ships.

Member Avatar for Helianthus
0
5K
Member Avatar for rajatC

Here's a couple links to command line argument help: http://malun1.mala.bc.ca:8080/~wesselsd/csci161/notes/args.html http://www.cprogramming.com/tutorial/lesson14.html As to running your program, be sure you opening the command window in the folder where the .exe file is located. That's the file you execute as in c:\dev-cpp\bin\> myprog.exe If you are unfamiliar with working at the command …

Member Avatar for joaquince
0
3K
Member Avatar for ASFtlink

You should check where the program crashes, and read the error message(s). Check your arguments closely - what's being used here, and what is being used without having a value assigned? [code] intResult = divide(number1, number2); //getAnsers from the user getAnswer(number1, number2, action, answer); //win or loss diviGame(result, static_cast<int>(answer), diviWins, …

Member Avatar for Lucaci Andrew
0
311
Member Avatar for stinkypete
Member Avatar for vmanes
0
151
Member Avatar for shankhs

Two points: C++ string is not required to have NULL terminator ('\0'), but you will find it present under many compilers. One should not use this as a limit on the extent of the string, use the .length() or .size( ) methods. C-style strings end with '\0', not '\n'. The …

Member Avatar for venugopal.somu
0
504
Member Avatar for happygeek

So if someone downloaded the pirated file over a secured, paid for connection, [I]Liberty [/I]wouldn't have any issue with that provider, just the actual downloader? I think their reasoning is, since the free-loading downloader is unidentifiable, they have to try and snag someone. How about the owner of every router …

Member Avatar for WebCopywriter
1
907
Member Avatar for MasterHacker110

The loop control is the big problem in the logic. [CODE] while(file1.good()) [/CODE] won't stop the process till the file reading fails. If the file is ended properly (with a newline) the loop will process all lines, then will enter again, read the blank line, have nothing to process but …

Member Avatar for vmanes
0
188
Member Avatar for pygmalion

Users of version 1.0 of anything are really paying to be Beta testers.

Member Avatar for WolfShield
1
516
Member Avatar for khajvah
Member Avatar for vmanes
0
243
Member Avatar for Run.[it]

Oops, let's clear this up. cin.get( ) does just what it says - it gets a character from the input stream. Any character, including whitespace (blank, tab, newline). You can use it two ways, for this simple purpose: [code] char ch; cin.get( ch ); //or ch = cin.get( ); [/code] …

Member Avatar for Narue
0
3K
Member Avatar for demroth

One of the things you are doing correctly is passing the file handle to the function. However, in main( ) you're making some mistakes with the filename variable. Line 18 - you're declaring the filestream and initializing with the filename variable - but that variable has no value. You don't …

Member Avatar for demroth
0
3K
Member Avatar for kreyd

Your problem is, how many of a coin do you get from the money? How do you do this in real life? Take 83 cents as an example. How many halves come out of that? How did you determine that? If half dollars were not available (quarter being your biggest …

Member Avatar for 3bodd
0
282
Member Avatar for maria536

Without your problem statement or the input you used it's hard to know just what your results should be. Offhand, I'd hazard a guess that you should be adding the raise to the annual wage before calculating the next year's raise. Something like [icode]wage = wage + (raiseMoney * i);[/icode]

Member Avatar for maria536
0
1K
Member Avatar for adkool
Member Avatar for crunchie
2
896
Member Avatar for GrimJack

How about [URL="http://www.youtube.com/watch?v=X1tmuq8xufo&feature=related"]this[/URL]?

Member Avatar for GrimJack
1
171
Member Avatar for GrimJack

[QUOTE=GrimJack;747270]I keep finding these [URL="http://www.projectcensored.org/top-stories/articles/3-infragard-the-fbi-deputizes-business/"]scary stories[/URL]! I sleep well but sometimes I fear (for) the future.[/QUOTE] There's nothing scary at all about [URL="http://www.infragard.net/"]InfraGard[/URL]. It's about education and information sharing. The members and member organizations have no police powers, can't do anything anyone else can't do. That story is so full …

Member Avatar for Netcode
0
601
Member Avatar for cipherbeale

Two things about the code jump out [code] student::student_id() { int sId=000; } student::student(string n, int i) { n=sName; i=sId; } [/code] In the first function above, you are declaring sId, where it's already a datamember of the class. And you don't need a constructor for the data member, you …

Member Avatar for Narue
0
993
Member Avatar for Muralidharan.E

The only case I'd make for Win98 is if you have some hardware or software you need, that cannot work (or work well) on later versions of Win. For me, it's a large format printer that never got drivers in XP that fully use its capabilities.

Member Avatar for caperjack
0
281
Member Avatar for clyo cleopas

Two things that jump out at me. 1 - there's no question asked. You won't get much help if you don't point us in the direction of where you're having trouble. 2 - see the sticky posts at top for information on good posting. Especially, use code tags, like this: …

Member Avatar for thines01
0
305
Member Avatar for sneekula

When every one of your accounts has a unique, random password, and you can remember them all.

Member Avatar for Netcode
0
674
Member Avatar for The Buzzer

Hmm, I thought I was in the C++ forum. Oh, I am! This C code works for me, I see the numbers. How are you viewing the resulting data files? Keep in mind that putw() is writing an int to the file, not the ASCII values representing the numbers.

Member Avatar for raptr_dflo
1
137
Member Avatar for by_the_blood

Part of the above advice is not pertinent to your problem or your code. [icode]i < scores.size()[/icode] does not give you size of your array. It would be a good idea to make the loop limit test in your functions use variables for rows and columns, and pass those sizes …

Member Avatar for laosland
0
1K
Member Avatar for Sadun89

Elizabeth Taylor Hilton Wilding Todd Fisher Burton Burton Warner Fortensky

Member Avatar for zachf632
0
222
Member Avatar for webdragon89

To start with, you're trying to decrypt the original input string! [code] string temp=encrypt(code,pass); cout<<"Encrypted Code: "<<temp<<endl; string temptwo=decrypt(code,pass); ///should be (temp, pass) cout<<"Decrypted Code: "<<temptwo<<endl; [/code] Fix that, and it works.

Member Avatar for Grimm#13
0
695
Member Avatar for rluo502

What WaltP gave you is a version of Bubble Sort. You can find many explanations and references on the 'net. To compare one string in your array to another, yes, you use only the first index. As in [code] order = strcmp( arr[j], arr[j+1]; [/code]

Member Avatar for vmanes
0
231
Member Avatar for suraj_p

[code] for(i=0;[B]i<=3[/B];i++) { for(j=0;[B]j<3[/B];j++) { //input } } for(k=0;[B]k<3[/B];k++) { for(l=0;[B]l<3[/B];l++) //output [/code] Look at the difference between the loop test in your input and output sections? Shouldn't they be the same? Or at least use the same relational op?

Member Avatar for suraj_p
0
179
Member Avatar for skatamatic
Member Avatar for robab
0
167
Member Avatar for vmanes

We use bumper stickers to proclaim our political/religious/moral/immoral/humorous and other feelings. If you could post a new bumper sticker on your vehicle every day, what would it say today? (Please, one post per day) [b] Do you drive in a phone booth? Hang up NOW! [/b]

Member Avatar for Lardmeister
0
600
Member Avatar for biancaW

I don's see you doing anything to test if a set of inputs is in order to begin with. Before you sort the strings, check their order, using code similar to the first block in your sort, setting a flag if an out of order pair is seen.

Member Avatar for thekashyap
0
131
Member Avatar for frogboy77

I started answering questions here to give back. I got a good piece of code from one of the DaniWeb contributors, and felt it was worth it to help out some. It also helps me be a better teacher in seeing more problems that students have, and working out how …

Member Avatar for jon.kiparsky
0
269
Member Avatar for scarlettmoon

The avg( ) function is working fine for me. You should perhaps do an output of the values after the sort, to be sure that you've not corrupted the data there. Just what do you mean by "a tad wanky"? If it's not correct, it's not correct.

Member Avatar for mike_2000_17
0
381
Member Avatar for BTW8892

Line 35 - what's 'i' doing there? I take it your loop at lines 34,35 should be displaying just the high temps and you will write a similar loop for the low temps? So, how are you pointing to the correct row of temp data?

Member Avatar for vmanes
0
114
Member Avatar for benjybob

You don't need both time.h and ctime. Just ctime is sufficient. Are you defining a function srand() in your codefile asteroidsgame.cpp? It also helps to typecast the return from time() to an unsigned int to make srand( ) happy. Your use of rand() is OK, assuming you are looking for …

Member Avatar for benjybob
0
425
Member Avatar for a.muqeet khan

Welcome to DaniWeb First, it does help to put the code in code formatting, like this: [noparse][code] your code goes here [/code][/noparse] Second, please try to be more specific in your question - such as what incorrect result do you get (and what should the correct result be), what error …

Member Avatar for a.muqeet khan
0
115

The End.