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

Why? What is it you don't understand? Looks straight forward to me.

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

When you enter the number of books, the \n you typed is still in the input buffer. This is read as the first input in Initialize(). Look at the cin.ignore() method

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

Better use short or short int for age variable since this has the least range other data type.

Shorter than char? I don't think so...

Use cin to read the age variable.

You realize this is the C forum, right? That code can't possibly help.

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

Yes, cookies are required to contribute to DaniWeb.

I'll ship you a box tomorrow. Oreo or Chips Ahoy?

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

Agreed. A message box that says something like
"Are you posting code without using CODE tags? YES NO

NO dismisses the box and they can add the CODE tags if they need and know how.
YES opens a complete description of how to use them.

The only question is how to detect that there's code.

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

Did someone ignore the request to read the Member Rules that mentions CODE Tags?
Or the info at the top of the forum that talks about CODE Tags?
How about the background of the text box where the message was entered that also mentions CODE Tags?

What could we have done to make the info about CODE Tags more readily available?

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

Try looking up the syntax in your text. There's no way you wrote all that code without some form of book or on-line help.

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

The program is ultimately supposed to take the command line argument then sort the list by SSN. The user is then supposed to be able to search for SSN's. I can't get passed the first stage. Right now I'm trying to get the program just to print the data from the file, so at least i know the program sees it, then I'll worry about the sorting.

I asked

So what does your program do? What did you expect it to do instead?

not "what is it supposed to do eventually". You didn't answer either question...

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

You have to specify a value, not a variable, when defining an array:

double x[16][2];
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

A lookup table is a list of values. You define the array and it's values at compile time:

float sinLookup[] = { val1, val2, val3, ... };

Each entry corresponds to one angle you want available.

Get the angle, use it as an index into the array to get the sine. Of course you need to figure out how to take the angle and convert it into an integer index. That's the main task.

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

Forget the fseek(). Just don't output the space when you've output the last value.

Don't output the value and the space together. Output them separately so you can control each of them.

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

%cat t1 proves t1 is a file.
What the 5 is for on the $ ./a.out 5 t1 I don't know. It's unnecessary.
The command should simply be $ ./a.out t1

So what does your program do? What did you expect it to do instead?

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

Because it's simply a pointer to a single char, there is not sufficient memory allocated where that char is stored to hold an array of char.

Actually, there isn't even a single char. It's just a pointer to nowhere in particular.

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

Search the string for the digits, pull the substring out, then convert.

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

If you use endl, you will always get one line for each output. Use endl only after outputting 3 values.

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

And keep in mind 5/9 = 0. That's integer arithmetic. You want 5.0/9.0 to get the correct answers.

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

I agree, the assignment is so poorly described it's really hard to understand.

The assignment is:
Ask user for a number N representing the maximum number of digits for two integers you wish to add. (ex- enter 4 for 2 4-digit numbers, enter 20 for 2 20-digit numbers)

Ask for 2 numbers up to N digits long, and add them.

The 2 numbers should be read into an array, 1 digit for each array element:
enter 2461 and you get
array[0]=2
array[1]=4
array[2]=6
array[3]=1

The rest is up to you...

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

If you enter the number 2651, they will fill
A[0]=2
A[1]=6
A[2]=5
A[3]=1
You just need to move the values so you have
A[0] to A[24]=0
A[25]=0
A[26]=2
A[27]=6
A[28]=5
A[29]=1
and so on. 2 simple loops and a little thought will help you accomplish that. Look at the pattern above.

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

So how many threads do you want to keep track of? Do NOT create new threads for the same question, keep posting in the same thread!

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

I'd like to. When a professor is teaching you C++ with a compiler built almost 30 years ago, what are you really learning? Non-standard coding practices, functions that don't exist today and haven't for decades, techniques you will not be able to use if you ever want to find a job. The least he could do is use a free compiler that is up to current standards. Many exist, then he can at least teach you standard C++ which will help you become a professional.

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

You'll have to read the input as a string and test each character to be sure they are digits. If they are, convert the input to a number. This would make a great function. Return the number or -1 if not a number.

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

Decimal to octal:
Divide the number by 8, the remainder is the one's digit
Divide the new number by 8, the remainder is the eight's digit
Divide the new number by 8, the remainder is the 64th's digit
etc. until number is < 8

101 decimal
101/8 ==> 12 R5
12/8 ==> 1 R4 ==> Answer 145 octal

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
do{         
   cin >> point;

   position_y = ceil(point/n);
   position_x =(point%n)-1;

    int game_board[99][99];
    int value(1);

// Why are you regenerating the matrix each and every time you input a
// value?  This erases any previous points you've changed.  Move the 
// following loop above this DO loop. Be sure to think what else needs 
// to move and what what needs to stay inside the DO loop.    
    for(int y=0; y<n; y++){
        for(int x=0; x<n; x++){
            game_board[x][y] = value++;
            game_board[position_x][position_y] = -1;
        }
    }
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

First, format your code so we can follow it.

Replace the value in the array with -1 for X and -2 for O. Then during output, display the letters instead of numbers for negative values.

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

Try formatting your code so we can follow the program flow. As it is, it's hard to follow.

And give us a clear explanation of what your problem is, as well as an attempt to solve it.

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

Cool I see how that works. Thanks! Where should I enter system ("cls") to clear the screen though?

Nowhere!!!! It's unprofessional to clear the screen for no real reason. It's also programming for a specific operating system so it's not portable.

Unless there's an actual need to execute a child program, you should avoid using system() .

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

I have no idea what newToCheck is for.

Line 8 defines it as a char pointer. No size so there's no storage.
Line 29 seems to serve no purpose at all.
Line 31 uses newToCheck[n] but the location has no storage space, so even if you tried to run the program you'll probably crash.

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

You call stack() to initialize the stack. You only need one stack.
You call push() to put values on the stack.
You call pop() to remove values from the stack.

That's about it...

When you calculate one of the digits, push it. When done, start popping.

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

If they are numbers, read them as an integer.

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

Because you did something wrong. That's why you're getting that error.

And since we can't see your code, that about as much as we can guess at. Your description tells us nothing useful.

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

That is some of the worst code I've seen! 16 lines with the following problems:
1) void main() -- main is ALWAYS an int.
2) clrscr() -- no current compiler has this function and it's a bad idea to use it in the first place.
3) gets() -- the most dangerous input function ever written, can easily cause your program to crash
4) getch() -- another function that should not be used, very non-standard
5) no conio.h which is required for getch() and clrscr()
6) doesn't really find multiple (consecutive) spaces, only counts spaces
7) no CODE Tags

IOW, don't bother with the above post...

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

Actually, the best solution is to make the variable an int rather than unsigned. That is assuming your 'fuel' will never go beyond 2+ billion

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

Help with what? Do you really expect us to search through 246 lines of code looking for some unknown problem?

When asking for help, you need to explain in detail what you need help with.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
if char = '.' then print ' ' else print char
if char = ' ' then print '.' else print char

something like that.

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

Umm, they are both 4 digit values, each has 3 distinct digits. Based on the values, they may be father and son.

If this is not helpful, maybe you can clarify what you mean by 'relationship'

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

If players is global, why are you passing it around? I believe you are not changing the global variable but the local variable passed in by value.

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

So why don't you post your current code in the python forum? :icon_rolleyes:

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

1/1! is not 0, it's 1. Do the math -- what is 1!?

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

Your basic problem is if you don't know how to use something, you can't program it. Any algorithm you try to use in a program you need to understand.

Sit down with paper, pencil, and a good description of the principle and work out how it operates. Be sure to test the idea with highest and lowest values, and values that don't work to understand how to error check.

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

Because when you enter a character, rather than checking if the character is a vowel first you enter a loop. Then you check if it's a vowel for each and every letter in the puzzle.

So, why enter the loop if the character entered is wrong?

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

Another problem. srand() should only be called once during program execution. Move the function call to the beginning of main()

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

From this reference:

[system()] Invokes the command processor to execute a command. Once the command execution has terminated, the processor gives the control back to the program, returning an int value, whose interpretation is system-dependent.

This says that your program waits until the command executed with system() finishes. Does AvastUI.exe end?

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

Hey! Forgot about me? I'm still here. So, would you please, pleeeease help me with this and next homeworks? Plllllllllllllllleeeeeeeeeeeeeeeeeeeease?

Tried. You haven't bothered in the last 23 hours to do what has been suggested -- which should have taken you maybe 30 minutes. Can't help if you won't accept the help.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
for (int a=0; a<size; a++) 
        for (int b=size-1; b>=a; b--) {
            if(set[b-1] < set[b]) {

                temp=set[b-1];

What happens to temp when b == a in this loop structure?

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

It all depends on what line 36 looks like with your change.

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

Write some code already!!!!
Read a line of text.
Write the line of text.
End of program.

If you hadn't wasted the past 10 hours BSing and trying to convince us to write it for you, you'd be on to the next step already. As it's going, you won't be there until Friday.

Nick Evan commented: Yep. +16
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Unload the workbook form from the unload method in the password form.

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

The next step is whatever you have to do once you are able to read the string and can write it out. Whatever that is. Start with what I mentioned above with a new project and build it a piece at a time.

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

My suggestion is to start over. Write only the first part of the code and get it to compile and run without errors:
1) Read a line of text
2) Write out that same line of text.

Nothing more until it work perfectly. Then move on to the next step.