5,676 Posted Topics

Member Avatar for PDB1982

Why are you putting a [ICODE]for[/ICODE] loop inside the [ICODE]while[/ICODE] loop? The [ICODE]for[/ICODE] loop will get in your way if there are less than 8 values.

Member Avatar for mrnutty
0
88
Member Avatar for myz068u

Your program is backwards. You want to 1) start a loop 2) ask for input 3) use the switch 4) continue with loop until exit command entered

Member Avatar for mrnutty
0
104
Member Avatar for jprogram

[QUOTE=jprogram;1183939]I have been trying to do this assignment for the past 4 days. I thought I was doing good but the functions seem to be screwing up. All the greater than and less than functions are messing up. Also the add and subtract functions are messed up. Any suggestions would …

Member Avatar for WaltP
0
119
Member Avatar for Atomika3000

This code will not do what you want: [CODE] //Populates the grid with x's for(int i=0;i<5;i++) { lifeBoard[rand()%19][rand()%19] = 'x'; } //Populates the grid with o's for(int i=0;i<100;i++) { lifeBoard[rand()%19][rand()%19] = 'o'; } [/CODE] What if during the population of the [B]o[/B]'s you overwrite an [B]x[/B]?

Member Avatar for Lerner
0
4K
Member Avatar for 3cats

[QUOTE=3cats;1177824]I have never posted to a forum before. I am taking a beginning C++ prgmming class. [/quote] It shows. You didn't bother to read the Member Rules and made a bad post... Start by [url=http://www.gidnetwork.com/b-38.html]formatting your code[/url] so you can follow it. This error is almost always because of misplaced …

Member Avatar for 3cats
0
170
Member Avatar for Ron_HL

Stop writing code that causes C2664 and C2562 errors would be a usable suggestion. That might mean looking up what the errors mean and either memorizing the descriptions & sulutions or writing them down for future reference.

Member Avatar for Salem
0
97
Member Avatar for gregarion

All you are doing is testing the first character and returning 1, 2, or 3. You need to set a variable to 0. Instead of returning in your loop, set the variable to the appropriate number. But be sure to check the value before setting it otherwise the value will …

Member Avatar for mrnutty
0
94
Member Avatar for gregarion

Internet Code Lesson #1: a) If you want to llearn how to do a task by looking at code b) If the code you found doesn't work z) Do not use it. Find something else. Why bother with it if [B]IIIX[/B] == 13. What can you learn?

Member Avatar for gregarion
0
109
Member Avatar for cwarn23

Because 1% of the posts that resurrect an old thread might actually have some useful information -- not for the OP but for someone just dropping in. 80% cause problems by 1) Hijacking the post 2) Posting bad code requiring people to correct it 3) Posting wrong code requiring people …

Member Avatar for WaltP
0
355
Member Avatar for acos.carlos
Member Avatar for WaltP
0
124
Member Avatar for jprogram

Jeez! [ICODE]if (false)[/ICODE] is always false because [B]false[/B] is -- wait for it -- [I]false[/I]!

Member Avatar for WaltP
0
96
Member Avatar for sportsguy90

1) [url=http://www.gidnetwork.com/b-58.html]See this[/url] about using [iCODE]feof()[/iCODE] 2) Write a truth table for your 2 [iCODE]while()[/iCODE] statements and see what they should look like.

Member Avatar for WaltP
0
133
Member Avatar for mommie

[QUOTE=mommie;1183645]Thank you that actually worked. I tried single quotes but not double quotes. I don't know why I didn't try double quotes in the beginning. [/quote] Programming isn't a trial and error process (at least not with syntax). If you have a string, you [I]know[/I] if and when, and which …

Member Avatar for WaltP
0
95
Member Avatar for DawnDenise

[QUOTE=DawnDenise;1182612]I would like the output of this string to display each word in a column and ignore all punctuation. I have tried including an if statement that tells the string to start on a new line when a space is encountered but I haven't had any luck. Any hints are …

Member Avatar for DawnDenise
0
164
Member Avatar for sjgman420

[QUOTE=Robert1995;1181766] [CODE] //And a shuffle system void switch_with_last(long cards[53],int pos){ long aux; aux=cards[cards[0]]; cards[cards[0]]=cards[pos]; cards[pos]=aux; } int shuffle(long cards[53]){ int i,shuffles; srand(time(NULL)); for(shuffles=1;shuffles<=500;shuffles++){ i=1+rand()%cards[0]; switch_with_last(cards,i); } } [/CODE] [/QUOTE] This has 2 problems. 1) [ICODE]srand()[/ICODE] should only be called once -- at the beginning of the program. 2) This is …

Member Avatar for Freaky_Chris
0
885
Member Avatar for Darkwarrior_331

I really get tired of people simply saying "it doesn't work" and expecting us to figure out what it's doing wong. [B]Tell us[/B] what doesn't work. What happens? Does is crash? Does it melt the monitor? Does it bomb South America? If you need help -- give [B]DETAILS[/B]

Member Avatar for mattjbond
0
151
Member Avatar for skorm909

[QUOTE=skorm909;1182709]oh well im sorry it just looks better this way to me i even showed you where the errors are so i dont see why thats a problem[/QUOTE] If that code looks better to you than properly indented code, then you may as well expect to have lots of problems …

Member Avatar for skorm909
0
194
Member Avatar for Darizuka

Do you know how to use the computer you are trying to copy the files from? [QUOTE=jwenting;1181652]MS-DOS is NOT available in Windows XP, nor is it in Windows 98. It was retired with Windows 95. There is a command shell that has pretty similar commands available to it, but that's …

Member Avatar for jephthah
0
302
Member Avatar for fugnut

[CODE] int LoadArrays (ifstream& inputdata, int age[], double premium[]) { int index = 0; while ( index < Max_Array && inputdata >> age[index] >> premium[index]) { index ++; } [/CODE] In my opinion, this loop is more confusing than it needs to be. If you want to use [I]Max_Array[/I] like …

Member Avatar for WaltP
0
86
Member Avatar for jgehlot09

[QUOTE=jgehlot09;1179503]I have a file name fun.c contain the fuction to add two number (addnum(a,b)).Now I create another file name callfunc.c.Here I want to call the function (addnum(a,b)) from the file fun.c. How can I do that?.[/QUOTE] Create a header file [I]fun.h[/I] with a prototype of the function. Add [ICODE]#include "fun.h"[/ICODE] …

Member Avatar for jephthah
0
234
Member Avatar for RexxX

Just set up a buffer of [B]x[/B] chars. Open the file for binary read. Loop, reading [B]x[/B] chars from the file. Write the characters. Exit the loop when the read does not actually get [B]x[/B] chars -- you've hit EOF.

Member Avatar for WaltP
0
184
Member Avatar for Juicy5ursoul

And if you want us to be able to read your code [url=http://www.gidnetwork.com/b-38.html]format it[/url]!

Member Avatar for WaltP
0
183
Member Avatar for lavendon89

You are making things very hard for yourself. Just use the [ICODE]scanf()[/ICODE] and check the return value. You don't need the [ICODE]ungetc()[/ICODE]. Other changes: Get rid of the [B]\t[/B]'s in the [ICODE]scanf()[/ICODE] format. They aren't needed. Exit the loop when the return from [ICODE]scanf()[/ICODE] is not as expected And [url=http://www.gidnetwork.com/b-38.html]format …

Member Avatar for WaltP
0
99
Member Avatar for mjltech84

[CODE]Public Class Form1 Private Sub btnCompute_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCompute.Click Dim pizza, fries, drinks As Double ' inputs by customer pizza = CDbl(txtPizza.Text) fries = CDbl(txtFries.Text) drinks = CDbl(txtDrinks.Text) displayBill(pizza, fries, drinks)[/code] You are calling the function with the number of items ordered (I think- …

Member Avatar for jeffreyk16
0
100
Member Avatar for jaymeaux77

[CODE]Read a line Loop [I]strchr()[/I] for a SPACE or EOL copy characters before the space to another string Use [I]strcmp()[/I] and loop to find the letter Test the next character for SPACE. If so, output another space Skip to next morse character Endloop [/CODE]

Member Avatar for jephthah
0
267
Member Avatar for 2koolguy

Not even going to bother. First, [url=http://www.gidnetwork.com/b-38.html]format your code[/url] so we can read it. Next, ask a question we can answer. That starts with details of the problem, not just posting the assignment and nothing else useful.

Member Avatar for 2koolguy
0
202
Member Avatar for Divyab
Re: HELP

Dis iz error: U dint explan nutin. U writ 2 mch cde an dnt tst it. Plzzzz expln wat prblm iz. We dun unrstnd prblm. && U dint spk English. Cnt unrstnd not English

Member Avatar for LevyDee
0
154
Member Avatar for HoldmysunnyD

[QUOTE=lotrsimp12345;1154838]don't do it with a stack you are typing too much... use recursion very powerful and easy to understand.[/QUOTE] Just because you learned recursion recently and it looks kool, it is rarely an acceptable alternative to a loop. Way too many resources are used and you can crash your computer.

Member Avatar for em-kay
1
283
Member Avatar for gregarion
Member Avatar for Robert1995
0
182
Member Avatar for 2koolguy
Member Avatar for deeep

It's identical to what you've found. The data just comes from somewhere other than the keyboard. So the data input is a little different, all the rest is the same.

Member Avatar for deeep
0
205
Member Avatar for geekgirl2011

also, [iCODE]facesInhand[numberInHand2][13][/iCODE] is beyond the array. The array stops at 12, not 13.

Member Avatar for geekgirl2011
0
116
Member Avatar for quicka_29

[QUOTE=abu taher;1164935]if you convert 10 to 'ten' then try this No declarations at all. 1. Create a form and add two textboxes; TextBox1 and TextBox2 2. Add a command button; CommandButton1 3. Copy the code below to the code window. 4. Run the program, enter the number in TextBox1 and …

Member Avatar for dreemebird
0
300
Member Avatar for CreativeCoding
Member Avatar for miskeen

Only if each and every line is exactly the the same length. If they aren't, you have no way of knowing where any line starts.

Member Avatar for miskeen
0
101
Member Avatar for solistus

Get a degree. In the 60's and 70's it was easier to get a job without one. But today, why would you hire some self-taught person rather than someone that has a formal education? Would you buy a house built by the guy's brother-in-law executive that likes woodworking or one …

Member Avatar for BestJewSinceJC
0
205
Member Avatar for MVB

First warning: [I]disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.[/I] You don't care that VC doesn't like strcpy so turn the error off. Next error: look on line 21 and before for the missing ';'

Member Avatar for Salem
0
425
Member Avatar for jgehlot09

You have to move it then. What you are doing is [CODE]output a character at the left edge of screen; wait; output a tab; return to left edge; repeat;[/CODE] How can you put the character where you want it?

Member Avatar for MyrtleTurtle
0
122
Member Avatar for aa_day90

I'll bet its your [iCODE]while (!file.eof())[/iCODE] statement. [url=http://www.gidnetwork.com/b-38.html]See this[/url] ([ICODE].eof()[/ICODE] is the same as [ICODE]feof()[/ICODE]

Member Avatar for aa_day90
0
96
Member Avatar for a4aadi

[B]user_book[count].bn[temp][4][/B] is a single character. Change it to [B]user_book[count].bn[temp][/B]

Member Avatar for a4aadi
0
98
Member Avatar for hurricane123

[QUOTE=n.utiu;1179054]Use C++ string, they are better, and more stable.[/QUOTE] C-strings have been around a lot longer than the C++ string class -- therefore they are quite stable...

Member Avatar for webs1987
0
120
Member Avatar for Asheem

[QUOTE=Asheem;1179565]Guys, in this program, we have a file by the name of asharray.txt, which is attached to this post, and we have three functions: 1.to read the file 2.to sort the numbers 3.to write to a separate file by the name of( array result.txt) Sp, here I faced some problems, …

Member Avatar for Asheem
0
234
Member Avatar for akinso

I'd search Google rather than searching forums. There's more detailed information there.

Member Avatar for akinso
0
95
Member Avatar for sarenameas
Member Avatar for Anand111

Add the program to the Start=>Programs=>Startup list. It will start when the user logs in.

Member Avatar for vijayan121
0
81
Member Avatar for SCMAN2010

And [url=http://www.gidnetwork.com/b-38.html]format your code[/url]. It's very difficult to follow.

Member Avatar for WaltP
0
123
Member Avatar for Martje

You actually did it in reverse. [code] int main() { char *namen; char test[255] = "Test"; namen = test; cout << test << endl; cout << namen << endl; return 0; } [/code] The pointer can receive the address of the array. Not the other way around.

Member Avatar for WaltP
0
105
Member Avatar for Fenlevi

[QUOTE=Fenlevi;1178820]It still does not work,maybe my function definition for two dimensional vector is not right?[/QUOTE] Maybe you sould post the [I]exact[/I] error message and tell us the [I]exact line[/I] the error points to. That way we don't have to guess.

Member Avatar for WaltP
0
105
Member Avatar for TSaunders84

Use 2 indexes, 1 for '[I]student[/I]', 1 for '[I]new position[/I]'. Start them both at 0. Increment both indices until you find the student you want to remove. Increment only the student index. Now continue to the end of the array copying the values in the '[I]student[/I]' index into the positions …

Member Avatar for WaltP
0
78
Member Avatar for robski

And it's not dependent on the [I]operating system[/I]. It depends on the [I]compiler[/I].

Member Avatar for Ancient Dragon
0
108

The End.