WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Threads should remain open as a rule of thumb, and there should be no rule/movement against contributing to those threads at any time provided that contribution is on topic and adds something worthy to the thread in question.

Where the addition is spam/hijack etc then it gets dealt with using existing moderator processes.

Define etc. Does etc include "Me too", "Good code", "Thanks" resurrections, or are they part of the "adds something worthy" form of reply?

jephthah points out, another level of questionable resurrections. In some cases, a post that supplants previously good code with crap. Are they also "worthy" simply because they tried to help?

Here is my biggest complaint. Dani states she wants 'black and white' rules. You can't have b&w rules. What mods need are workable guidelines. If a resurrection doesn't add worth to the thread, what options can we choose from? And yes, sometimes worth is subjective. How do we decide?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

- if it's lacking code tags, it's work for me (to report), and work for mods (to edit)

This one IMO you can stop reporting. We'll find non-tagged code, at least in the heavily trafficked forums.. I always have to backtrack and find I've already dealt with the tags.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And please fix your indentation! It's very hard to read.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Jeez! if (false) is always false because false is -- wait for it -- false!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've seen those, the only problem is I don't truly understand them so I don't know what is going on. Like I said, new to C++, maybe 3 months under my belt? I can simply rip an algorithm from somewhere and add my "filler" but then I have no clue what it actually does... ya know?

Yea, I know. And knowing the Bubble Sort has nothing to do with C++. I had to learn the bubble sort years before there was even a C language.

You should study the bubble sort
1) copy working code for sorting numbers instead
2) write down 4 random numbers for an array
3) run the code by hand (not on the computer)
4) write down every change to every variable on every line.

That will go a long way toward understanding. You could also find an explanation of the bubble sort and read it. That'll help too.

jonsca commented: Was that on the Whirlwind? +4
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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 reflect only the last character.

At end of the function, return variable;

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

1) See this about using feof() 2) Write a truth table for your 2 while() statements and see what they should look like.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

As Salem said in his first post

First, indent your code.
http://sourceforge.net/apps/mediawiki/cpwiki/index.php?title=Indentation

Or if you don't like his link, use this one. The reason is
1) you want our help
2) you post code we cannot read
3) if we can't read it, we can't help.
Think about it.

As for your sort, you have ratings defines as a character array. You can't say array1 = array2; so use strcpy()

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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.

Programming isn't a trial and error process (at least not with syntax). If you have a string, you know if and when, and which quotes are needed.

Now it compiles but I'm trying to get it to return to the beginning where it ask if you want to enter measurements because as it is right now it just goes right back to asking for name and measurements because the answer is still yes as far as the program is concerned. Please take a look and let me know what I can change.

If you are using the program, what would you expect to happen once you've entered the measurements for the current person?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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 IIIX == 13. What can you learn?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Yea I wish they would put their money where there mouth is and send is a check for the difference :) But they aren't really that stupid. They just think we (the consumer) are -- and many people actually fall for all that crap.

And I remember the car dealerships that would claim:

If we can't beat your best deal, we'll give you the car for free!

What a crock!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Benny Hill was terrible. Laugh-In was great! Does anyone remember the TV Show "Turn On"? 10 points for those that do... and 10 more for knowing why it's infamous!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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

If that code looks better to you than properly indented code, then you may as well expect to have lots of problems with missing braces and parentheses and very few people that are willing to help you because it's impossible to read.

Good Luck

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
int LoadArrays (ifstream& inputdata, int age[], double premium[])
{
	int index = 0;

	while ( index < Max_Array && inputdata >> age[index] >> premium[index])
	{
		index ++;
	}

In my opinion, this loop is more confusing than it needs to be. If you want to use Max_Array like you are, then a for loop is what you want.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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 most welcome.

I don't see any attempt to do what you want. All you did is output the line character by character and never tried to output a newline.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
//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);
      }

}

This has 2 problems.
1) srand() should only be called once -- at the beginning of the program.
2) This is not a 'shuffle' function. This is akin to throwing the cards at a fan and picking them up. Grab a deck of cards and study what really happens when you shuffle. :icon_wink:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And if you want us to be able to read your code format it!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You are making things very hard for yourself. Just use the scanf() and check the return value. You don't need the ungetc() .

Other changes:
Get rid of the \t's in the scanf() format. They aren't needed.
Exit the loop when the return from scanf() is not as expected
And format your code. It's really bad and hard to follow.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Have you looked at the actual documentation for fgets() ? Do you know what the function does with the \n of the line read?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

certainly not. It's a 32 bit command shell, not a 16 bit operating system :)

And I repeat: That is a worthless pedantic detail. I have never used the 32bit command shell any differently than any 16bit DOS/DOS Clone prompt. Each and every command I've used works and what's "under the hood" is completely invisible.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Since your examples are ambiguous, you need to be a little more explicit.

Starting at 2.000, what values gets rounded up to 3.000? 2.001? 2.100? 2.5?

If it's as low as anything > 2.000, simply add 1.0 and truncate.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do you mind if i PM you some code (not for a homework answer...)?

Against the rules... And it helps no one else. We are not a personal tutor service.

How can i convert this to binary, or even treat any number in c as binary to use bit operations on them (like 1<<y).

It already is binary. Everything in a computer is binary. Only the output is converted to a human-readable format.

if you have an integer with the value 65 and output it as:
Decimal you get 65
Hex you get 41
Octal you get 61
Binary you get 01000001
Character you get A

Once you grasp this concept you will be ready for the next step.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

First thing I'd do is format your code so it can be followed easier.

Then, in CheckNumeral() display the important values as the code runs. See if there is a bad character being read, like a space or something.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do you know how to use the computer you are trying to copy the files from?

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 not the same.

As far as anyone is concerned, this is a worthless pedantic detail. The operation of CMD.EXE is virtually identical to DOS from a user standpoint, and any idiosyncrasies are immaterial for the requested task.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Not even going to bother.

First, format your code 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.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do not post homework problems expecting a quick answer
without showing any effort yourself. This especially pertains
to the software development forums. For easy readability, always
wrap programming code within posts in code (code blocks)
and icode (inline code) tags.

Without posting what you've done, all you've asked us to do is write it for you. If you have a question, post the pertinent code section and give us details of what you're having trouble with.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Yeah, so? Do you have a question we can answer?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Read the Member Rules....

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
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
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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

Fbody commented: Nice :D +1
jonsca commented: Yes +4
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I really get tired of people simply saying "it doesn't work" and expecting us to figure out what it's doing wong. Tell us what doesn't work. What happens? Does is crash? Does it melt the monitor? Does it bomb South America?

If you need help -- give DETAILS

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What does "comes out wrong" mean? Maybe details would help.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

We've got thousands of them. some are better than others, but i guarantee you none of them teach on 20-year-old obsolete compilers.

I wouldn't be so sure about that... :icon_twisted:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You'd be better off just creating a data file rather than trying to figure out the INI file format and the complexities of parsing it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Cobol -- well, maybe not... That's just a short step to -- shudder -- RPGII! :sweat:


opinion of a diehard software engineer... :icon_mrgreen:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If you guys would stop replying to the posts, the spamlink would die. But, no, you have to keep adding more information to get your point across and keep the thread active. Keeps the spamlink active.

I'm just sayin'

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

From the list of active threads (like here) click on the yellow Start New thread button.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

We're programming experts, not video experts. The ffmpeg forums would give you better answers if you can ask the right questions. Or other video forums. There are a lot out there.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

No, that's your job. You know the particulars of your system and client/server needs. We haven't a clue what your system, communications protocols, nor desires are.

Sit down with pencil and paper and start sketching out what you have, how you can use it, and so on. We can help when you get to the coding phase and maybe a little during the design phase.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Write them to a settings file of your own creation.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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.

Salem commented: Yes +20
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You have to move it then. What you are doing is

output a character at the left edge of screen;
wait;
output a tab;
return to left edge;
repeat;

How can you put the character where you want it?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I am having problem with line 52

Why? Does it not compile? Does it operate wrong? Does it threaten to blow up Japan?

Do you know what details are? From here:

1. an individual or minute part; an item or particular.
2. particulars collectively; minutiae.
9* to relate or report with complete particulars; tell fully and distinctly.
10* to mention one by one; specify; list: He detailed the events leading up to the robbery.
13* in detail, item by item; with particulars: The résumé stated his qualifications in detail.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If you really must know the time, here you go.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
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)

You are calling the function with the number of items ordered (I think- there's no comments for proper understanding so I can only guess)

End Sub

    Sub displayBill(ByVal num1 As Double, ByVal num2 As Double, ByVal num3 As Double)
        Dim sum As Double
        Dim calnum1, calnum2, calnum3 As Double
        Dim fmtstr As String = "{0, -15} {1, 17:n} {2,19:c2}"

        'calculation for number of item ordered
        calnum1 = txtPizza.Text + num1
        calnum2 = num2 + txtFries.Text
        calnum3 = num3 + txtDrinks.Text

Now you add the number of items ordered to the number of items ordered passed in. So you have twice as many items as entered.

'Price of each food item
        num1 = 1.75
        num2 = 2.0
        num3 = 1.25

Now you wipe out the values passed into the function.

Hope that helps.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

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, in the third function and I am not able to figure it out, so guys anyone who can resolve ma doubt..............

I doubt it.

You've been asked to provide details before.

Since we don't know what you are having problems with, we cannot provide suggestions. As mentioned before, we cannot read your mind.