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

340,282,366,920,938,463,463,374,607,431,770,000,000 addresses.

how do you pronounce that number?

340 undecillion, 282 decillion, 366 nonillion, 920 octillion, 938 septillion, 463 sextillion, 463 quintillion, 374 quadrillion, 607 trillion, 431 billion, 770 million

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

In my opinion, those anti-virus companies are the ones making the viruses.

You wear a tinfoil hat, don't you?

Watches too many gangster movies about the 30's protection rackets....

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

Or how about

Private Sub cmdremove_Click()
         For i = list1.ListCount - 1 to 0 step -1
            If list1.Selected(i) = True Then
               list1.RemoveItem i 
            End If
         Next i
      End Sub

Start at the end and move to the beginning.

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

You are using the size of full to test characters in temp. Are you sure temp has >= characters than full? Display the values and see.

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

okay but not only do i need a portable substitute for system("cls"),

No you don't. There is no reason for a console program to clear the screen. It's actually annoying to the user.


And this was mentioned a couple times, just not strong enough for you to hear it, so I'll try:

Never, NEVER, NEVER call main() ! NEVER! It is not a function per se/ It is the entry point to your program from the O/S. If you need to start the program over, use a loop.

And get rid of conio.h . It's not standard and you don't need anything from it.

Lastly, what do you need windows.h for? What are you using from it? Whatever it is, you probably shouldn't be using it, either.


PS -- true to form when someone says my problem is easy, it becomes a mega-thread. The word easy is the forum equivalent of radiation on the animal kingdom that creates monsters. And saying incredibly is just turning up the Roentgens! Easy my butt... :icon_twisted:

jonsca commented: Thank you. +6
NP-complete commented: wondering the same while flipping the pages...:) +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Your basic problem stems from not knowing what you need the program to do. For example, in your description you say:

I am creating an application in which converts celsius to fahrenheit and vice versa.

All well and good - as far as it goes. Then you continue with:

The application has to ask what the user wants.

Well, I want a pizza. No? How about... :icon_wink:

You have to know what you are going to give him, and ask for the information you need to get that gift to him. So the first thing is a C to F conversion. Single temperature? A range? When you give the answer do you ask for another or do you exit with a job well done?

Once you figure all that out, then you start designing the program. But on paper only!
Start with:
1) what do I ask for and how does it look to the user.
2) when I've calculated the answer, how do I present the answer to the user.
3) with the stuff from 1, how do I get to step 2?

Now you're ready to code just the initial input (step 1). As you do that, print the responses to the screen as if they are the output. Just to be sure the input is completely working.

Start with that...

And please format your code better. There is too much indentation and it's also inconsistent.

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

Does anyone have any idea why 1/3 of the time Win7 will not boot? Sequence is:
Dell Inspiron boot screen
Blank screen
Windows wallpaper screen
Blank screen with mouse pointer centered
Nothing from then on.

Turn off machine.
Turn on
Boots fine. Usually.

Since Windows does not like to show us what's happening, there's no clue to the problem.

Are there settings I can turn on to watch what's happening and maybe see where it gets stuck?


There are no viruses, so we can eliminate that suggestion right away.

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

ok thank... so I got that part right...
but now I cant convert string into char

You don't need to.
stringValue1[0] is the first character.
stringValue1[1] is the second character.
stringValue1[4] is the fifth character.

You don't need to put the string into a character array.

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

I (hopefully) can get the normal file displays to show in LIST mode but I see no way to get Save File or Open File lists out of Details mode. Any ideas?

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

So with your new and improved code, how do you pass the integer back to main() ? I think jonsca's idea is best.

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

They do not create .exe files, only compress/decompress EXISTING .exe files.

Not true. There is a setting to create the archive as an EXE file. When you execute this file the archive is decompressed automatically. Not sure exactly how they do it, though. I assume they have the 'exe' file front end that the archive is appended to as a data segment.

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

ALright so below is my updated code, but i having so much errors...where have I gone wrong?

By saying there are errors and making us guess what they are...

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

Since average is not an array, what do you need i for?

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

Sounds like you need to explain what you want to do. The answer is yes and no, depending on what you want to happen.

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

I've never had too many problems with eof(). Do the proper checking and you're in like flinn. Regardless what it is good for, I use it handily for binary and text files. What is OP? Is this some sort of class or something?

You've probably been taught correctly when eof() returns FALSE. I've found that most people use it without being taught correctly.

OP is shorthand for Original Poster, he who posts first.

And it's Flynn, by the way. A proper name. :icon_wink:

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

When you look at your post, move your eyes to the right. There seems to be a lot of possible answers already.

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

And does your compiler support C99?

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

The values it returns are:
1367821597
-2
2001180890
2001248506
4788024
4787832
2293528
2001248029
0
0
2147315712
180
172
3023400
43
2
2293544
2001247796
2293608
4198592

That shows you exactly what I mean. If you don't set the initial value of a variable -- ANY variable -- to a value, you have no idea what the value is. Saying int x; does not make x a 0. It could be anything.

So when you use a value, unless you initialize it in some manner ( x = 3; for example) your data is unknown. Print it, you get junk. Use it ( b = x*3; ) and you get junk.

Note to others: Yes I know about global variables -- ignoring them....

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

Come up with an idea and we'll help you fine tune it.

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

Plase check my code and tell me if anything else required to be done.

Add error checking. How do you know the input file was opened? How do you know the input file was read?

And please fix your formatting. Your code is hard to follow with your inconsistent indentation.

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

You can't with Standard C++. Keyboard input is designed to wait until the ENTER key is pressed. You need to get into special O/S system calls for Asynchronous input -- input that simply checks if there is input and continues.

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

visual basic 6.0 code!

What does this mean? Do you think we'd help you with Python code or C++ code in this VB6 forum? No need to be redundant.

"15 Minutes allowance"
-LogIN time is 7:00-7:30
-Beyond 7:30 is Late
-beyond 7:45 is absent

And this is....? Maybe input? Maybe output? Maybe instructions?

code for making a condition in attendence
If it is:
*Absent
*Late
*Present

There is no code here. We can't help if we don't know what you're asking.

please help!!!

With what? You need to ask a question and post important information and explanations necessary to understand. We aren't psychic.

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

Start by looking yo the function difftime()

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

"It doesn't work." That's the best description of the error you can give?

Without code nor a description of what it does wrong, there's not much to say. Based on what you've posted it's because you didn't actually use cout << "The average value for box 1 is:" << avg1

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

Depends completely on how you designed the program, what constitutes a line, how the command is entered. I can think of 10 ways it could be coded and none of them are compatible.

How much design work have you done so far? An editor is not something you can just start coding.

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

First thing you need to decide is what happens if 2 or more characters are entered? If this is not a concern, just use cin.get() . Keep in mind all the extra characters will be waiting for the next input. That can mess the user input up royally.
If it is a concern and you only want the first character, read the entire line into a temporary string and move the character into the input string.
Third option is jonsca's suggestion.

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

I assume you can use arrays since you are already using pointers.

Are you also aware that each character value is just a number? 'A'=65, 'B'=66, 'a'=97...

You can set up an array of 256 set to zero and use each character as an index to increment the values. This will count each individual character -- letters, digits, spaces, everything.

Then once you've accumulated all the counts, simply add the ones you need: totVowels = count['a'] + count['e'] + ...

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

OK. Why are you starting Notepad? :icon_rolleyes:

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

The logic is slightly off.

If we click the UP or DOWN, the vote is automatically counted. Then a box pops up with two buttons,
1) Vote
2) Leave message and vote
The box also has the standard corner X to dismiss the box.

The vote should only be taken when one of the two buttons are clicked. If the X is clicked, no vote should occur.

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

This is C. The Standard does not allow you to define variables after executable statements as you do in lines 22-25. The definitiosn must be above the while() statement.

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

Why are you redefining string1 and string2 in lines 18 & 19? Technically, the placement of these statements is illegal in C.

You strcat() to string1 but you never reset it's value back to "file".

Also, please learn to format your code[/url\. It's extremely important the larger your programs grow, and if you need help, formatting helps others read your code.

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

I can't allocation for a zero

int header_file_len=0;

and then

header_name=(char *) malloc ((header_file_len)*sizeof(char));

What's the value of header_file_len?
Then what's the value of header_file_len * sizeof(char)?
Therefore, how much space is being malloc ed?
Is that enough to be useful?

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

You need to read the input as a character string. Then look at the string and make sure every character is a digit. If so, convert to integer, if not display an error.

L3gacy commented: thanks +1
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Since you process choice even when it's 11, my guess is nameArray[11-1] is beyond the array bounds.

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

Why are you starting Wordpad?

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

I think I've followed the formatting rules fully and here's the code I have.

Except for the TABs to SPACEs part... Otherwise, it looks much better.

My confusion is coming from the x variable and the array size.

I don't understand what x is, unless it's a count for the columns, and every time x increments, we're moving to the next column.

Call me dense, but if you don't understand what x is, why is it in your code? Since you wrote it, you need to know what each variable is.

With the array size, does char[s][6] specify 6 wide, or 7 wide? Does this mean to make the array 6 characters wide I should change the 6 to a 5?
Because I know that it starts at 0, but I assumed that for size it's different and

Why would it be 7? It's a 6. Reread what I posted last time, and check it with your book. Why aren't you looking this stuff up in your text?

I also have continually returned outputs similar to this: 0x22fea0
And was wondering what causes it.

You never initialized any values, so there's garbage in the variable.

Run this:

#include <iostream>
using namespace std;
int main()
{
    int v[20];
    int i;

    for (i=0; i<20; i++)
        cout << v[i] << endl;
    return 0;
}

What values do the uninitialized array contain?

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

kk

Would this code work?

I done it! Yes! i Have used if to only 2 lines of code and you was asking me to pay you lol!

Still thanks.

actually i realised now it don't work

Fixed it now i need to add couple more features then done!

Thanks for tweeting :icon_rolleyes:

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

Yes, format your code! If it's not formatted next time, you're on your own. I already gave you a link to look at.

If your definition is char a[s][6]; and you changed the assignment to a[x][6] = r[i + j]; , I would expect it to blow up. You are writing beyond the limits of the array. The second index can only go from 0 to 5. 6 is beyond the range.

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

Since you can't use the debugger, I'd suggest outputting key variables after key statements in your code. Like after an open, after an input, after an important calculation. Do the variables contain valid information?

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

Sorry, this is what I tried:

for (i = 0; i < 5; i){
  for (j = 0; j < 30;j){ //couldn't understand the by 6 part of your suggestion
    a[x] = r[i + j]; //this line shows "error 32 incompatible types in assignment of `"
    x += 1;
  j++;
}
i++;
}

If it's completely not what you meant, I'm sorry, a little new to this

No, it's not quite.

First, please learn to format your code. If the code is difficult to follow, it's difficult to help. I like the way you format each line, but the indentation is extremely important throughout the program. Be consistent.

Second, in the statement for (i = 0; i < 5; i) , what is the last useless i for? That should be i++. Yes, I see it at the bottom of the loop, but that's not where it goes. All you have is a while loop using for Third, my code said for j = 0 to 30 [B]by 6[/B] . You do that by adding 6 to j: for (j = 0; j < 30; j[B]+=6[/B]) Last, x += 1; is better written as x++; -- but you probably know that.

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

I assumed that the "do not use spaces" instruction was put in the code by the OP as a kind of hack, to be used until a solution to the problem of spaces was found.

Well, you know what they say about assume :icon_wink:

I've see too many assumptions made on this board that are extremely wrong and 10 posts try to help using that assumption. If the OP isn't clear, he needs to make it clear.

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

The best debugging tool you have is cout . Display the variables at various spots in your program to see what's happening at key statements.

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

I'm afraid I have no idea what you are suggesting, I tried messing with your pseudo-code but I get it to work.

Since I can't see what you tried, I can't point out what you did wrong.

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

@WaltP: i is the "loop variable" its the one that increases in the for loop.

Good.

in1 es the initial value of i, and it changes depending on user imput. If the user want to print the rest of the map values, it increases in1 by 10, so the next time it runs the for loop instead of being 1 its 11.

Then why did you implement it as a function prototype? int in1(1); is not defining a variable in1, it's specifying a function (notice the parentheses).

What you want is int in1=1;

Same applies for in2, except its the last value of i, so if the user wants to see more map values, its increased by 10. Thats what lines 22 and 23 do.

Yes, the same applies.

And, embooglement, at these forums we don't "fix up a bit" the code of others. We give help and let them fix the code. We have enough trouble with their professors getting POd at the students because someone hands them their assignment on a silver platter.

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

Do you need to convert at all? If you're not going to do any maths with the numbers then you just leave them and print them to the new file. If you do need to convert them, you can use atoi() to do it.

I agree in that I didn't understand the need to convert to int and then write it out again.

Assignment. How to convert digits into an integer. That's why. A very basic process needed by programmers. Made slightly more complex by the addition of non-digits. Another basic process called problem solving. instructors usually have a reason for their weird assignments...

If you have an array of integers:
2,4,6,8
How do you make 2468 as one integer out of it? Think LOOP. Think 10's.

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

OK Guys, the code explicitly says:

cout << "Enter Your Banner Name (Do not use spaces)" << endl;

Note: (Do not use spaces)

The OP said

When I run my program and type in I am Iron man it messes up. It says that I have 13 letters. It counts my spaces as letters. How can i fix this??

You fix it by following the instructions in the code: IamIronman

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

So use loops. The first assignment:

{r[0],r[6],r[12],r[18],r[24],r[30],
 r[1],r[7],r[13],r[19],r[25],r[31],
 r[2],r[8],r[14],r[20],r[26],r[32],
 r[3],r[9],r[15],r[21],r[27],r[33],
 r[4],r[10],r[16],r[22],r[28],r[34],
 r[5],r[11],r[17],r[23],r[29],r[35]};

can be written as:

x = 0
for i = 0 to 5
  for j = 0 to 30 by 6
    array[x] = r[i + j)
    x = x+ 1
  next j
next i

Look for the pattern in the other assignments.

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

You aren't thinking this problem through properly.

Roman numerals have the same 'design' as Arabic numbers: thousands, hundreds, tens, ones places. The difference is Arabic values have 1 character for each, Roman has multiple.
100: C < D
10: X < L
1: I < V

742 = DCCXLII -- 700=DCC 40=XL 2=II

So, look at the string and find the hundreds characters and process them accordingly:

hund = 0
while roman[i] is a hundreds-char
    if hund = 0 then 
        hund = arabic-value(roman[i])  ;; first value, save it
    else
    if hund < arabic-value(roman[i]) then 
        hund = arabic-value(roman[i]) - hund  ;; next value is greater, subtract previous
    else
        hund = hund + arabic-value(roman[i]) ;; add

    i=i+1
end while
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

BTW, I lived a couple of years in Pullman, Wa.

That's your problem. There are different programming rules for the rest of the world :icon_twisted: (just kidding)


Now, explain to me what the line int i, in1(1), in2(11),a; does, and how the variables relate to the line for (i = in1; i <in2; ++i)

Heres the code as is, without gutting. I didn't put the load map function, but it loads succesfully.

Maybe so, but I believe, as embooglement also believes, the code posted doesn't even compile. So back up and tell us what the real problem is.