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

How do I remove extra spaces in between?

In between words, lines, sentences, paragraphs, or characters? Please be explicit. Only you know what you want and we can't read minds if you're not in the room with us.

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

Before you jump into windows programming with both feet, you should read this intoductory tutorial.

As well as this ;)
and this, the Keep It Organized section at least.

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

I wana make so many lines appear randomly (like heat beat rate) depend on the base line ..while I run the program .
How can i make that works . pls give me some hints or code ,,

Define what "so many" means. Also "depend on the base line". Not a clue what you mean.
The heart beat is far from random -- at least in most people.
Please take more care in forming your question, and explain clearly what you are trying to do and what it's supposed to look like.

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

Word Perfect

plain or regular?

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

to arrive belching

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

But that takes effort!

Ummm, yeah...

Damn I thought there was a single click deployement for nested quotes.. this much effort *phew*.

Kudos to those who multiquote :D

Kids! What a bunch of lazy.... :rolleyes: Back when I was young, I use to --- Oh my GOSH! I sound like my dad!! :eek:

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

I just love your new avatar, WaltP.

Thank you. Thought you might... :mrgreen:

And a much better role model :confused: -- you're not smoking anymore!

I didnt know I was a role model ;)

OK, maybe roll model, then...

And btw can someone please tell me how to nest the quotes.

Editing...

Select Multiquotes on the original post/quoted text and the post you are directly quoting. This gives you
[QUOTTE=WaltP;280530]And a much better role model -- you're not smoking anymore![/QUOTTE]
[QUOTTE=~s.o.s~;280534]And btw can someone please tell me how to nest the quotes. [/QUOTTE]

Now just move the 2nd quote tag to the beginning:
[QUOTTE=~s.o.s~;280534][QUOTTE=WaltP;280530]And a much better role model -- you're not smoking anymore![/QUOTTE]
And btw can someone please tell me how to nest the quotes. [/QUOTTE]
giving you

And a much better role model -- you're not smoking anymore!

And btw can someone please tell me how to nest the quotes.

See above... :cheesy:

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

Btw, nice avatar. :D

Hehe thanks -- suits my personality. Evil, calculating, serious, dark....:twisted:

And a much better role model :confused: -- you're not smoking anymore!

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

First of all, did you color the code yourself? If so, please don't. Using code tags properly will color it for you. it's [[B]code=vb[/B]] (no spaces) at the beginning, and at the end of the code [[B]/code[/B]]. Also, indenting your code would help a lot, too.

I can't figure out how your question and the code is related. You mention

When the user clicks the calculate button, I determine the total number of entries (listgrades.item.count); this value is returned correctly. I then try to copy the contents of the listbox into an array as I thought that would be the best way to determine the highest, lowest, and sum of all the grades.

Why are you defining strallgrades as a string if you want to find the lowest, highest, and sum? Wouldn't integers be more appropriate?

I would then use the sum/total to get an average.

Where is sum calculated? I expected to see a + somewhere in the code used to add the values together.

Update the code to add the grades together and see how that works. mIf it does, try calculating the average. If it doesn't, post again and we can tweak your attempt.

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

Here is a link that might help you. Sending graphics to a lazer printer is not quite as simple as what Walt described, but similar -- I have not tried it myself.

I was answering based on

... that has to print a report on a laser printer.

I've always output reports in text. Doesn't matter that the application is a graphics app.

So, is the report a graphical report, or just some basic text information?

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

I'm hoping to use it to learn VB so that I can learn to use VBA in Excel and Word. Do you think I can do this with VB4?

I think you'd be better off just learning VBA if that's your main goal. Look for a VBA tutorial and start there.

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

Mountain Dew, the beverage of Techies... I'll take it any way it comes (except diet :confused:)

I can drink either cola, Pepsi or Coke, but for different reasons. If I want sweet, Pepsi, if I want acidic, Coke.

Cabonated water? Blech!!! Absolutely disgusting!

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

Hi,

I have this application in Graphics that has to print a report on a laser printer.

Is there any way to do it....

The application has been designed in Turbo C++...

Yes, output to stdprn.

#include <stdio.h>

int main()
{
    fprintf(stdprn, "knvnovnsvn;lvns;lvn;lvnda;lvndsvnd\f");
    return (0);
}

This worked fine in Turbo C++ v1.0
The '\f' at the end of the text forces a new page.

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

Yeah, code tags are missing making any indentation you have for readability nonexistant -- therefore readability is very low.

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

no its not sorry
4 is way too old (i think its 16 bit actually!!1) as 5 came out in 1996

No, Win95/VB4 was 32 bit.

Win3.1 was 16 bit and was essentially a DOS program rather than an O/S.

I doubt you can get an upgrade at this date but you can ask.

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

Any one who is master is developing Messenger please help me. I will do my work on my own i just want some guidence. Free lancer are encouraged. Reply me now a days i m designing use cases

Aren't the masters of Messenger at Microsoft? They could help you better than people who haven't developed anything like it... ;)

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

That was a typo I think, she has already taken care of this in her last post.

Noooo, her last post has void deleteS (char ptr[]) and the instructions say
"Your function may not use any square brackets."

IMAO, this includes the definition, and even if it doesn't, the def can still be written without brackets. :)

Anyway, if you notice the times, I was responding while she was posting. It takes me more than 60 seconds to type up a response. ;)

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

good day to all!!!!

can anyone help me with my project I dont really understand..... can anyone make a pseudocode for this problem.....
the problem is:


make a pseudocode that determine the biggest number.... pls.. reply....

i would really appreciate you if you can help me.... thnx...... luv yah!!!! friend!!!!

It seems to me that by writing the psuedo code, we do your homework for you. Maybe you shoud post what you have and we can help you correct it if it's wrong.

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

I pretty much agree with SOS. The act of passing a pointer seems to me to be a form of pass-by-reference since the value is not passed but a pointer that references the value. Therefore pass-by-pointer is akin to pass-by-reference.

And I would assume that rather than explaining all the itty bitty technical nuances between pass-by-pointer/reference it just simpler for the new programmer to grasp the concept as being the same. Time later to add the technical differences to their knowledge when the time is right.

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

My task is this, and I'm having trouble finishing up the code:

Here is what I've managed so far:

void deleteS (char* ptr[])
{
   int*counter;
   for (counter = ptr; counter<ptr + strlen(ptr); counter++)
   {
       if (isupper(*ptr + counter)
          strcpy (" ", i);
       else if (*(ptr + counter) == 's')
               // delete the s, and move any blankspace back

I can't seem to come up with the remaining code. I hear that I can use a vector to delete elements (which is what I want to do), but I haven't learned that yet ..

How would I be able to finish up?

First thing, your function definition should be void deleteS (char* ptr) -- this passes in a pointer, you are passing in an array of pointers.

Next, set up another character pointer. You are not dealing with integers in this function. I'll call this pointer source

Set this new pointer equal to the parameter, like you did in the for statement. Now both pointers point to the same address.

Start a while loop that exits when when you reach the end of source ( *source == '\0' )

In the loop,
1) Copy the current character from source to the current character of ptr.
2) Increment source to point to the next character.
3) If the current character in ptr (the one just copied) is not 's' or 'S', increment ptr to point to the next character. This will overwrite any S that …

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

Never used IE, always use FF.

Personally what I feel is that IE sucks...(atleast IE6).

How can you say this? You've never used it so what is your opinion worth? :twisted:

I haven't upgraded to IE7 yet (downloading now), but FF is my browser of choice, with IE available for the few times it does things better (such as not garbling downloaded file names).

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

It seems, a lot of people would-- they sell a lot.

I wouldn't, probably; I don't really like drinking pop much-- perhaps a Mountain Dew when I need a caffeine boost and my coffee limit is maxed. Coding all night, ya know ;) .

Not sure I understand this... What is it about coffee (other than caffeine) that has a limit where MD is OK (with caffeine AND sugar [please don't tell me it's diet MD :eek:] )

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

Besides this, I am quite happy with our system. I just see the need for vast improvements. There are scores (see, 100's of 1000's, if not more) of American people who go daily without their prescribed medicine, (the very medicine that just might cure their ills) because they cannot afford to pay for it and they do not have insurance.

And there are those that could be helped by the correct medicine, but the insurance will only pay for cheaper, "kinda-like" medicine that is not adequate. The creater of XTree is one that I know of.

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

Well gotta must make things as easy for the staff as we can :)

God bless!

Yeah, us mods are a lazy bunch of overworked.... Well, maybe not all of us... :)

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

Now, instead of agreeing on a color for a comment, we can work on defining what a comment actually is. Then, I can display my comments in grey italics (which looks lovely) and you can display them in green regular (which looks lovely).

The problem with this is that there must be a default, because most users wouldn't have a clue that they could define their own colors. So first order of business -- as cscgal is thinking of proceeding -- is to define the default color scheme. Anything else comes after.

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

You cant as such check for such conditions in case of a simple sort like bubble sort.

Take for eg. this array.
1 2 3 4 5 6 8 7

During the first seven passes no swap is performed since the next number is always greater than the current but a final swap is done in the last pass to sort the array. You cant as such terminate a bubble sort based on the flag that swap is performed or not.

Yes you can. You set the swap flag to FALSE between the two loops (inside the outer loop, before the inner loop). When the inner loop exits and a swap has been made, the swap flag should be TRUE. If no swap has been made, the flag should be FALSE and it's safe to exit.

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

There are multiple threads in this forum to do what you are looking for. You might even find one in the "similar threads" below...

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

My personal preference:
All the colors should be of a similar intensity. The switch from the keyword-yellow to function-underline/blue is too striking.

To follow more closely what I've seen:
comments in green
Numbers, "Strings" and 'characters' in royal blue
Keywords in bold purple

All else is black
C/C++ functions don't need to be colored, but if they are, use a dark color like maybe red

[b]int[/b]  getCharacter()
{
    [b]int[/b] ch;             // define the character
    [b]do[/b]                  // loop until a good character is read
    {
        ch = getchar(); // read a character
    } [b]while[/b] ( (ch == 0x20) ||    // check for SPACE
             ((ch >= 0x09) && (ch <= 0x0D)) // check for the other whitespace
            );
    [b]return[/b] ch;
}
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

As for setting quit to 1 does this mean I should break after everthing is found to be true?

I'd assume you want to break out when someone enters the command to QUIT.

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

The closest thing I can figure out is
1) you need to use consitant indenting so someone can actually follow the code easier
2) quit is never set to 1 followed by break ing out of the inner endless loop.

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

and, for my information does *(ptr+1) do the job. coz the aray is of type int which most probably takes two bytes. so isnt it supposed to be *(ptr+2) or just *(ptr++)

*(ptr+2) :
No. When adding to a pointer, the 1 is translated to 1 full unit, so the 1 == sizeof(int) *(ptr++) :
Yes, this would work, but that actually changes the pointer which was not the intent.

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

Generally you're right but 'cpp' is a legacy definition that I never got around to deleting. :) You're meant to use the same language names as in the code snippet library.

But why type cplusplus when cpp is shorter? And why such different color coding for cplusplus vs cpp vc c.
I definitely prefer the colors of CPP best, at least with this short test:

Code Tag = c
#include <iostream>
using namespace std;
int main()
{
    int arr[3] = { 5, 10, 15 };
    int* ptr = arr;
    int i;

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    
    *ptr = 10;          // set arr[0] to 10
    *(ptr + 1) = 20;      // set arr[1] to 20
    ptr += 2;
    ptr[0] = 30;        // set arr[2] to 30

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    while (ptr >= arr)
    {
        ptr--;
        cout << ' ' << *ptr;    // print values
    }
    cout << endl;
    return 0;
}
Code Tag = cpp
#include <iostream>
using namespace std;
int main()
{
    int arr[3] = { 5, 10, 15 };
    int* ptr = arr;
    int i;

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl;
    
    *ptr = 10;          // set arr[0] to 10
    *(ptr + 1) = 20;      // set arr[1] to 20
    ptr += 2;
    ptr[0] = 30;        // set arr[2] to 30

    for (i=0; i<3; i++) cout << arr[i] << " "; cout << endl; …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

warning C4996: 'strtok' was declared deprecated c:\program files\microsoft visual studio 8\vc\include\string.h(164) : see declaration of 'strtok' Message: 'This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'

Reinterpretation of this warning:
We at Microsoft know better than the standards committee that created the standards for C and C++. We therefore decree our way is better and don't give a flying %&#$ what the standard says. Switch to our proprietory functions so your programs aren't cross platform -- giving us domination over the computer industry. Mwah haaa haaaa!!!!! :twisted:
In other words, ignore them.


: error C2664: 'strlen' : cannot convert parameter 1 from 'char' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

What type of value is tokenPtr. What type of value does strlen() require?

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

When you post a question, post details about what the problem is, not just "it don't work". *ptr + 1 = 20; is not allowed. You can't have addition on the left the way you have it. Put parentheses around the terms *(ptr + 1) = 20; .

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

so this program suppose to find number of primes (number that divides only by itself) in the given range. I know the problem is with my "for" statement.. i just cant find it :( Thank you

You're Welcome.... :D


No wait... OK...

First, here's the code (formatted properly) that contains the problem:

int DivideBy = 2;
    for (int Number=intStart; Number<=intEnd; Number++)
    {
        while (Number%DivideBy!=0)
        {
            DivideBy++;
            if (DivideBy==Number)
            {
                intPrime++; 
            }
        }
    }

1st: set DivideBy before the while loop. You need that initialized foe each number in the for loop
2nd: testing if (DivideBy==Number) inside the loop does no good. You have to test it outside the while loop to see if you went all the way from 2 to Number. If do, it's prime.

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

Deja vu!

I've seen this somewhere before ;)

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

Your whole concept of arrays is missing some key ideas. Simply using the variable invalid does not indicate invalid data.
If invalid = 2 and valid = 2 then player[valid].name is just player[2].name. You might want to add an invalid key in your structure and keep track using player[x].invalid

And for

i = 1;
for(i != invalid; i <= count-1; i++)

you need to look up the format of the for statement. The first parameter as you have used it does nothing. And the loop itself will simply loop from 0 to count-1 irregardless of the data's validity.

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

Time library?

Time Library.

Look into time() , asctime() , and related functions.

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

"I am the god of hell fire -- and I bring you --- FIRE!"

Home made stuff ?

NO. Arthur Brown: mp3 video (minor glitch)

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

Was the suggestion via a PM ? IF so how are we supposed to support you? No thread as such related to C++ color schemes.

No. http://www.daniweb.com/techtalkforums/thread59169.html

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

I don't know, perhaps you can ask dani to change it?
In fact it wouldn't be such a bad idea if it were got rid off altogether. Hmm, oh well.

I have. No support.

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

"I am the god of hell fire -- and I bring you --- FIRE!"

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

Impressive...

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

The reason me and Vishesh call you Mr. is because it has a different meaning in our country. Here we use the title Sir or Mr. to a person who is more knowledgable than us or as a means of giving respect.

Heaven knows we don't want any respect flowing around here :eek:

Approved !! BTW the newbies would be in a bit of shock when I start calling you and Mr. WaltP "Sir" :cheesy:

Well, at least we'd get respect from someone!

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

Guys, I was showing formatting techniques to aid the poster. Multiple posts explaning the code is not helpful in understanding the formatting:

You will see the problem immediately if you format your code better:
Put each { and } on separate lines
Every line between corresponding { }'s should be indented 3-4 SPACEs.

For example:...

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

1st, IMAO you do not have to post the entire program, just the piece you are trying to fix, as you did.
2nd, as Ancient Dragon said, what's the name of the file? There is nothing in fname[]
3rd, please learn to format your code readably. You need consitant indentation. It's better to use SPACEs, not TABs. And it's good to use extra lines between sections, but not between everything:

int longest(void)
{
    char line[BUFSIZE] = {'\0'} ;
    int counter=0;
    int longest=0;
    char fname[128];
    FILE *file;
	
    file=fopen(fname,"r");

    while (fgets( line, BUFSIZE, file )!=0)
    {
        counter=strlen(line);
        if(counter>longest)
        {
            longest=counter;
        }
    }
    return longest; 
}

Another thing I noticed is a cute trick that you should not use:

nlines += c == '\n';/*Line counter*/

Instead use something easier to read:

if (c == '\n')  /*Line counter*/
{
    nlines++;
}
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The question I have is with your switch statement. What is the difference between all the cases? Could you describe the differences between each?

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

Not sure how to output using a loop? Can you show me please?

Simple. Using your code, and formatting it correctly with proper indentation -- please learn this. As your programs grow, they will become unreadable without proper formatting:

const int SIZE = 100;
int main()
{
    char sentence[SIZE];
    cout << "Please enter a short sentence: " << endl;
    cin.getline(sentence, SIZE);

    for (int i = 1; i < 100; i++)
    {    
//      sentence[i] = tolower(sentence[i]);
        cout << tolower(sentence[i]);   // output
    }
    for (int i = 0; i < 1; i++)
    {
//      sentence[i] = toupper(sentence[i]);    
        cout << toupper(sentence[i]);    // output
    }
//  return 0;        // wrong place 

//  system("PAUSE");  // Yech!!!!  Don't use this
    getchar();         // instead...

    return 0;        // right place 
}
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

As far as why not to use EOF is concerned, simple it reads the data from the file one too many times. For detailed explanation, see an excellent tuts by Mr.WaltP and if possible read all of them , they are good.

Actually, it's feof() that's the problem. EOF is a good thing to use, it just has to be used with a function that returns it... which fgets() does not...

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

Try it, JRM, enter 12A and see what happens. Be sure you put your cin in a loop.

well, here's what I did;

#include <iostream>
using namespace std;
int t;
int main()
{

    do
    {
        t=1;
        cout << "\nEnter the encryption key (1-25): ";
        int k;
        cin >> k;
        if ((k<1)||(k>25))
        {
            cout << "\nERROR: Enter a valid number moron!\n";
            t=0;
        }
    } while (!t);
    return 0;
}

** code reformatted to a more proper form**
Rather than going into a infinite loop, it will just fall though.

My mistake. Try entering just S (or any letter), or an invalid value followed by the letter, like 34B ;)