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

hello :-) I'm Sean and currently a 3rd year BS Business Admin. Major in Management Information Technology student...

due to my limited programming skill...

Because of limited programming skill, and I assume (dangerous I know) you don't wish to become a programmer, I'd go with Visual Basic or, if platform independance is desired, Real Basic.

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

Another thing you need to consider is fflush(stdin); /* workes with this compiler */ doesn't work with most. Don't get into a habit that will be hard to break later. It may work now, but it is wrong

Salem commented: Good show! - Salem +6
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

downpours make me wet

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

Tomorrow is better

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

the world exploded

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

I like the new format for each forum index. Compact is good! Thank you, Dani

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

I have no idea what any of that is. I just open the project and the deployment wizard makes a package of the executables and DLLs needed.

I get an error msg on launch and the application terminates.

gives no one any helpful information that can be used to pinpoint your problem. Even Shawn Spencer on Psych needs to see something useful ;)

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

...although it looks messy to me.

It sure is :)

I really want to learn!

Good. Then take Joe's advice and learn formatting.

After every { indent 4 spaces. Before every } unindent 4 spaces. That would make this section look like:

if( score >=A_GRADE && score <= 100 )
{ 
    letterGrade = 'A';
    aCount++;
    examNumber++;
    gpaTotal += A_GPA;
    examTotal += score;
 
}
else
{
    if( score >=B_GRADE && score < A_GRADE )
    { 
        letterGrade = 'B';
        bCount ++;
        examNumber++;
        gpaTotal += B_GPA;
        examTotal += score;
    }
    else 
    {
        if( score >=C_GRADE && score < B_GRADE )
        {
            letterGrade = 'C';
            cCount ++;
            examNumber++;
            gpaTotal += C_GPA;
            examTotal += score;
        }
        else 
        {
            if( score >=D_GRADE && score < C_GRADE ) 
            {
                letterGrade = 'D';
                dCount ++;
                examNumber++;
                gpaTotal += D_GPA;
                examTotal += score;
            }
            else 
            {
                if (score >= 0)
                {
                    letterGrade = 'F';
                    fCount ++;
                    examNumber++;
                    gpaTotal += F_GPA;
                    examTotal += score;
                }
            }
        }
    }
}

I like the way you added spaces in each line. That's a very good thing. It really helps readability :mrgreen:

As for the code, when you get to if( score >=B_GRADE && score < A_GRADE ) , haven't you already taken account of the score < A_GRADE part of the if because of the previous if?
Couldn't you make this one simply if( score >=B_GRADE )

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

I think it's a throwback from the old typesetting days. when the ' and " were slanted slightly, or they looked like a dot with a tail like in books.

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

1) ABKLJFDLKJLKKDFJ++++++ajkadsl;fkjld;akjk=====daskflj342343
1a)
ABKLJFDLKJLKKDFJ
++++++
ajkadsl
;
fkjld
;
akjk
=====
daskflj342343

Explanation: program groups letters and characters together, but moves to next line when a symbol is reached.

Look at isalpha(), isalnum(), and isdigit() functions

2) It also must recognize whitespace: A + B = C
2a)
A
+
B
=
C

isspace() for this.

3) It must recognize a matrix: D_1 = [1 3; 2 3 4; ; 4 5 6]
3a)
D_1
=
[1 3; 2 3 4; ; 4 5 6]

Work on this last....

4) If the user forgets the second bracket to a matrix: D_1 = [1 3; 2 3 4; ; 4 5 6

4a)
D_1
=
Need ']' to close matrix

Keep a counter for each pair of [, {, ( seen. Inc at open, dec at close. If by the end of the input any are not 0 you have a mismatch.

5) A regular sentence: Hello How are you
5a)
Hello
How
are
you

What about them? Would aple banena charry be acceptable as a sentence? I think this would be beyond the scope of your program.

6) Anything including invalid segments. The only valid operator segments are +-/* Invalid operator segments could be: +%-, +&!
Valid number segments can start with '.' or a digit. …

John A commented: Good info; thanks WaltP :) - joeprogrammer +6
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Also, read the 5th paragraph here before your next thread... ;)

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

Turn the inner loop into a function and just break or return from it normally. With a suitable return value, you can then break from the outer loop without using goto or state flags.

Brilliant! Why didn't I (and the rest) think of that? Good catch, Ravalon

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

And while you're at it, read the 5th paragraph here before your next thread... ;)

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

Please clean up your act.

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

Why are you starting a new thread to ask the same question? The old thread was fine. And using the PREVIEW button would show you that coloring code doesn't work

Breaking out of all loops from an inner loop is simply placing if statements at the end of the loops:

while (a < 20)
{
//  some statements
    while (b < 10)
    {
    //  first part of loop  
    if (b == 99) break
    //  second part of loop  
    }
    if (b == 99) break
//  even more statements
}

also i was wondering how to make it so that the program only takes integers and disregards any decimal values

Didn't my hint help in your other thread?

Also your formatting is dreadful. It's very hard to follow the program because of the placement of the braces and indentation. Try formatting more like:

printf("number entered:");
    printf("%f\n", acc);
    printf("\n");
    printf("enter operand:");
    while(1) 
    {
        do op = getchar();     // what is this statement supposed to do?
        while(isspace(op));    // what about this one?
        if(op == 'q') return 0;
        else                                
        if(op == 'c') 
        {
            printf("Calculator Cleared\n");
            break;
        }
        else 
        if (op == 'f') 
        {
            printf("Entering Floating mode");
                                            
            // start of integer mode 2nd half
            printf("enter second number:");
            scanf("%f", &num);
            acc = do0p(op, acc, num);
            printf("%f\n", acc);
            printf("press q to quit or c to start over: ");
        }
    }
    //end integer mode
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Messy desk, neat mind.

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

home to bed

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

Apology accepted.

You're too easy, Chaky ;)

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

Hi All,

I'm new to the forum....med programming experience.

I've built a database application in VB4.

It works fine in the VB environment.

As soon as I convert it to an EXE and install it on my PC at work - it stops working.

You have to use the "Deployment Wizard" to create a setup file to install the program an another machine. Look either under Tools in VB or Start:VB.

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

I wrote this code to produce a fibonacci seqeunce to a cretain number. However, when you get to a certain number, it starts producing negative numbers, and I don't know what to do.

Can you be slightly less vague than "a certain number"? It helps to give us all the information you have.

Also please format your code. It's very difficult to follow without proper indentation.

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

Dead Thread Head to Bed, Jed! ;)

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

unorthodox look at

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

Aliens are my friends.

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

long day, especially

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

VB isn't really a programming language at all, it's a rapid prototyping tool for user interfaces.
Anyone using it for more than that is asking for trouble.

I definitely disagree with you. It's as much a language as any high-level language. Many robust systems can be created with ease.

Now if you had said it's a nonportable language and can be used effectively for fast and easy prototyping, I would have agreed with you. But it is much more than that.

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

hm i changed the code and it complies now, but when i try to inter a number, an error appears

You must give us details. "An error" can be any of 300+ things.

Explain fully
1) what is wrong
2) where the problem is
3) what it should do instead
4) cut and paste errors (don't paraphrase them)

That way our psychic powers don't have to be used. ;)

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

Hello!

Help!!!!!!!!!!!!!!! How do I print in QBasic. I have tried opening it (the program code) in note/word pad but it comes out in funny characters.

What can I do??

Any advice will be appreciated.

Thanks.

Look up the command to save your file in ASCII format (it's an option to SAVE I believe). You've probably saved it in tokenized form which is not printable.

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

I like it.

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

yeah it is annoying. my friend is dyslexic and he always gets me to come over and read out those capchas (you know, the wierd text you have to enter to say you are not a machine)

I hope he lives close :mrgreen:

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

Elseweb I remember the site considering such things and I think they chose to ditch a horizontal scroller and let the width grow with the user' browser preference.
...
The H&V scrollers don't do much for me, I guess. To me they make the code a little more difficult to try to read.

Is dislike those that grow. I find too many people like to put 100 (even 200+) characters on a line and it widens the entire thread so every post has to be horizonally scrolled. It's just too hard to read. I agree the standard should be wider than it is, though.

And the way cprogramming does it makes no sense at all. The different sizes for the left box looks so sloppy. I didn't like it when they switched to that fomat.

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

OK, let's look at your code (formatted)

Private Sub cmdCalc_Click()
    Rem clear previous entries
    txtOutput.Text = ""
    Rem generate new numbers each time
    Randomize Timer      '' Don't need to use Timer
    For iter = 1 To 9
        num = Int(Rnd * 9 + 1)  '' your code
                '' Rnd returns a value from 0 to .999999 (almost 1)
                '' That number * 9 gives you 0 to almost 9 (8.9999...)
                '' convert to int to get rid of the decimal portion (0-8)
                '' add 1 to get 1-9
        num = Int(Rnd * 9) + 1  '' corrected
        txtOutput.Text = txtOutput.Text + Str(num)
    Next iter
End Sub

Also, how would I make one to give me numbers between 5 and 24, rather then 1 and any other number? That i really can't figure...

The difference between 5 and 24...

rndMax = 24
rndMin = 5
num = Int(Rnd * (rndMax - rndMin)) + rndMin

Note the parentheses to make sure all the values are grouped properly.

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

Let's see. "A multilingual coded Hello World! thread". In BASIC:

print "Hello Wereld"      ' Dutch
print "Hello World"       ' English
print "Bonjour Monde"     ' French
print "Hallo Welt"        ' German
print "Γειάσου κόσμος"    ' Greek
print "Ciao Mondo"        ' Italian
print "Hello Mundo"       ' Portugese
print "Здравствулте! Мир" ' Russian
print "Hola Mundo"        ' Spanish
end

Thanks to Babel Fish :mrgreen:

Hello Mundo? We portuguese native speakers are very angry at you and Babel Fish.

BTW, olá mundo!

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

U tht r typng lk ths need 2 read this now! TY

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

If you're sure that the newline is always the last charecter you could do

line[strlen(line)-1] = '\0';

It will always be the last character, if it's there. It may not in fact have been read. Always put an if testing to make sure it's there.


Also, harby, you need to use code tags. Read the words on the background where you type these messages.... They were put there for a reason.

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

To get over your clown phobia, watch "Killer Clowns from Outer Space" as soon as possible!

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

The way to remove those color tags is to highlight the post (Ctrl-A) and click the weird A in the upper left corner of the edit box.

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

Since we don't know what you are doing know, what can we suggest? ;)

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

That makes sense. The only way to do that as far as I know is by hand. As I said, there is no text in an image so you will have to eyeball the headlines and type them in. Even an OCR program won't help that much.

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

Your input is storing the ENTER you typed at the end of the word in the variable. You just need to remove it immediately after the input line. Use strlen() to help find the end of the value and replace the '\n' with '\0'

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

difftime()

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

Did you get your simple password system working? I have a similar task: I want certain passwords to open form A and certain passwords to open form B.\

Can you help?

Start a new thread (since this one is darkmessenger's) and explain in detail what you need.

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

Thanks...

Actually I am trying to write a program that'll search the pdfs for keywords. I guess i'll have to associate files with the keywords in the image then. I can think of only this method... Is this the only wayt to do that?

Thanks..

I really have no idea how you plan to "associate files with the keywords in the image" unless you mean connecting text file to an image somehow. Maybe you need to explain in detail what you are trying to accomplish, what type of images (bitmaps, jpg, etc)

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

Another confusing request...

I'm new at C++ and I'm trying to right a program that will generate random numbers from a range of 1-19. Here's how it should work, the program will generate 5 random numbers all ranged 1-19 and in random order. Once it chooses the first number, that number used for position 1(first number) cannot be used again, and after the second number is chosen it cannot be used again and so on. So basically it's like

postion one-19 possibilities
position two -18 possibilities (1-19 excluding position one number)

and so on until we get to position 5.

This claims you want random numbers, but this:

What I need is for the program to print out all possible combinations of these numbers.

claims you want all permutations. You can't do both. If you generate random numbers you can never be guaranteed to generate all permutations randomly. I see 2 programs here
1) generate 5 random numbers
2) generate a list of permutations.

~s.o.s~ has basically given you the help you need for each question. Although I have to say that for readability random_number = min + rand( ) % max ; needs parentheses: random_number = min + (rand( ) % max);

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

I'm confused. You claim

this the full code, which works like a charm...

which to me means it works without error. Then the sentence continues

except for the error when i close the program. (a normal 'send report' / 'do not send report' error).

which seems to mean is doesn't work. You then continue

I've narrowed it down to one line (a variabele being read from a file -> posted in red),

which is a line in the middle of the program, meaning the problem aborts long before the end of the program.

Very confusing. ;)

But the problem is easily explained...

In this code:

// creëren van patiënten variabelen
   struct ALLE_PATIENTENDATA patient[aantal_patienten];
 
//------------------------------------------------------------------------------
//  patientendata in variabelen steken en eventueel lijst opmaken
//------------------------------------------------------------------------------
 
   //de patientengegevens uit bestand in variabelen omzetten
   for (count = 1; count <= aantal_patienten; count++)
   {
       fscanf (bestand_patienten, "%d", &patient[count].nummer);
       fscanf (bestand_patienten, "%d", &patient[count].discipline);
       fscanf (bestand_patienten, "%d", &patient[count].leeftijd);
       fscanf (bestand_patienten, "%s", &patient[count].naam);
   }

assume aantal_patienten is 5. That means patient is an array from 0 to 4. Your loop goes from 1 to 5 so you load patient[5] which doesn't exist. You've just blown you memory and crashed your program.

Also see this to see why the following is a bad idea:

system("PAUSE");
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Submission Requirements:

- Full source code listing.
- User Manual as described.
- Disk (floppy or CD) containing electronic version of user Manual and source code

Our submission requirements:
Number 1
Number 2

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

Write a program the outputs sizeof([I]type)[/I] to display the size of each type in bytes. Then multiply by 8 for bits.

For example sizeof(char) will probably output 1.

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

I have been a Daniweb memeber for the last 3-4 months. I am now learning C++ on Linux on my own using the tutorials available on this very good site. But I always struggle a bit and sometimes a lot when I am looking for C++ related threads and discussions/code etc. Can we have a dedicated section for C++ discussions instead of having C and C++ together under the category Software Development.

Not a bad idea. Splitting has worked on other forums I deal with.

If not then, can we just request the members who want to post a language specific question (C or C++) to make the title of the new thread/question by following the below given simple rules in order to help all of us here.

We have a rule that states "Do not post threads with generic subjects such as "HELP ME" or "PROBLEM". Instead, clearly state a phrase describing the problem as the thread's title.". And we still get titles like

  • Help in deciding...(bear in mind that i am new to c/c++)
  • Need help with an assignment that is due tomorrow plzzzz
  • Another doubt.
  • C++ Builder.
  • struct output Help

so I doubt this is a reasonable request. ;)

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

they give you solid food in your cell?

Programmer's axiom: Man does not live by Jolt alone! :mrgreen:

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

It isn't. There is no text in an image. It's just part of the image.

You can try an OCR (optical character reader) program that can read an image (non-compressed, usually). The best one I found is from http://www.transym.com/index.html

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

Does anyone have a help file with the Windows API stuff in it? I have searched, but have not found any (atleast ones with working links...)

I am not a huge fan of the MSDN site... It is FREAKISHLY slow. I was actually thinking of an offline option...

So buy a book. There are many available...