Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It doesn't really matter where you put the space in the syntax, the compiler doesn't care. The examples you posted are all acceptable and correct. It's only a matter of programming style -- however you wish to do it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

That's why I said you have to change the coordinates of SetRect() so that the pixel location is within the coordinates of the static control. You might want to study this about mapping modes, unless you have already done that.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

this changes the colors, but the text is in the center of the window. I don't know if that is where the control is located or not. I made the background color yellow so that I could see that it is doing something. You will probably have to change the coordinates of SetRec() to something else so that it's within the boundries of your static control.

        case WM_PAINT:
        {

                         PAINTSTRUCT ps;
                         HDC hdc = BeginPaint(inst->hwnd, &ps);
                         RECT textRect;
                         SetBkColor(hdc, RGB(233, 189, 174));
                         SetRect(&textRect, 10, 210, 200, 200);
                         DrawText(hdc, TEXT("Hello"), -1, &textRect, DT_CENTER | DT_NOCLIP);
                         EndPaint(inst->hwnd, &ps);
        }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

First, you need to use rand() (click me) to generate random characters that can be used in passwords. Do this in a loop. Each time rand() is called check it's return value to find out what kind of character it returned (upper case, lower case, digit, or some other symbol)

If you look at any ascii table, such as this one you will see that all printable characters and symbols have decimal values between 33 and 126 (the space (decimal 32) is also considered printable but not useful for your program). So in order to generate a value between 33 and 126 the math is like this:

int ch = 33 + (rand() % 126)

Now, each time a value is generated search the array of password characters already generated to see if the new value is already in the array. If it is not in the array then add it. If the character is already in the array then ignore it and continue the loop to generate another random character. Since we don't know how many times this loop will repeat itself its best to use a while loop then break out only after the required number of characters have been validated.

Don't attempt to write all that code at one time, you will most likely just get confused if you do. Write a few lines, then compile and test that it works correctly. After that repeat until the program is done.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When there are more than 3 or 4 parameters it's better to create a structure or class to hold them all so that the function itself has only one parameter. It's a lot easier to read and understand that way.

why in the voucher print function its not displaying cost near hire cost

You need to put some print statements inside that function to display the values of all those parameters. Or better yet, learn to use your compiler's debugger.

Note: function AmountDay() doesn't work right either. Regardless of whether daysamount[i] is a digit or not the function returns on the first iteration of the loop. Also, daysamount is a string array, not an int array, so the second test to see if the value of daysamount[i] < 1 is not a valid test because daysamount[i] is a character, not an integer.

Here's how that function should work

bool AmountDay(string daysamount)
{//function checking the string taken in is digit
    for (int i = 0; i < daysamount.length(); i++)
    {
        if (!isdigit(daysamount[i]) || daysamount[i] == '0')
        {
            return false;
        }
    }
    return true;
}

AddDriver() also has a problem -- The function needs to return a value before it exits at the bottom of the function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This is on my agenda today -- Happy (Hickup) New Year!

9361c2be19a491d7067ab6c9129da9cb

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Granted, now all your bones creek, you're too fat, can't sleep at night, and have nightmares about wishing your life away.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yo mama is so gorgeous I went blind when I saw her.

<M/> commented: lol... +0
DeanMSands3 commented: Way to fight the tide, AD. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Im unpopular no matter what i say so i decided not to care anymore. I have other things to worry about.

I don't know why you have so many down votes -- seems like someone doesn't like you for some reason. Sometimes we receive down votes for some unknown reason, I've received a few of those too. Just try to improve the quality of your posts and you will be given up votes.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Is the hard drive nearly filled up?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@AD, not that kind of stick man! like a little sketch, lol!

Ok, then I used an eraser and erased you.

I wish i didnt have to go to work

Granted -- you got fired so you never have to work again.

I wish I didn't have to eat.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I prefer dereferencing using -> because it's simpler and doesn't make me think about it. Similar to a native English speaking person reading code written in English instead of some other language that has to be translated into English. Both might do the same thing, but one is more easily read than the other. And that's one of the big purposes you want to achieve with the code you write -- make it understandable, not cute.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This wiki article explains how to calculate the sandard deviation.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Granted buuuut ur backyard was overgrown with pioson ivy and oak.

No problem -- I'm not alergic to either, I just go out and pull them up with my bare hands.

<M/> commented: tough guy ;) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know a thing about it, but according to wiki there is only one king of the Belgiums (Philippe).

at the moment we have two kings and three queens!

Oh, I didn't know they were Mormons :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know python either. If you need it for school project then I assume they think you already know python. If you don't, then get a book or online tutorial and read it. You won't learn a thing if someone else does your schoolwork for you. Afterall, learnikng is why you are in school, isn't it???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Neither -- all .NET languages are compiled into what is called Common Intermediate Language (CIL), conceptually similar to .obj. Then it uses a Just In Time (JIT) linker to produce the final executable. I have not done it but I understand CIL code can be easily disassembled back into its original source code, either CLR/C++, C# or VB.NET. On some platforms I suppose CIL could be just interpreted, but normally it's compiled.

Visual Studio (and probably other .net compilers as well) does all that for you if you tell it to create an executable.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

and I'm hoping to learn more of win32 programming before .Net.

IMO learning win32 api us only useful for maintaining lagecy (existing) code -- not for starting new project. win32 api could be deprecated sometime in the not-too-distant future.

(read somewhere) that CLR/C++ is a massive bloat and slows apps down

That may have been true at first, but it has evolved since then, and is still evolving. It uses the same identical .NET functions as C# and VB.NET.

I'll stop there before I come across as advertising it.

No need to worry, QT is recommended by almost everyone for writing cross-platform programs.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Christians usually think they're better than everybody else and thus deserve special priviledges

Not at all -- I just find it rather funny that the entire world has adopted the Christian calendar. Why not adopt the Chinese calendar? It just goes to show that the birth of Christ was one of the most significant and important events in world history. No other person, living or dead, has had more influence on the history of the world.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

yea, I enjoy stirring the pot occasionally to see what falls out. :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Your link doesn't work.

Why start a new program using pure win32 api? It is a lot easier just to use Windows Forms and CLR/C++, C# or VB.NET. Visual Studio will create a basic windows GUI app for you in just a few seconds.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Funny, all you athiests out there so willingly use the Gregorian calendar, which is based on Christian holidays (Easter, Christmas and the birth of Christ). If you don't believe in God then why use the Gregorian calendar? Why not the Chinese or some other calendar? Even the year 2013 means 2,013 years since the birth of Christ (which is just a guess).

The term Anno Domini is Medieval Latin, translated as In the year of the Lord,[1] and as in the year of Our Lord.[2][3]:782 It is sometimes specified more fully as Anno Domini Nostri Iesu (Jesu) Christi ("In the Year of Our Lord Jesus Christ").

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

put a print statement after line 17 and display the value of rc.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The answer might be simple (lock them up forever), but the available resources are not. Where are you going to put them? Why should they get free room and boasrd (in prison)? In USA we alreasy have too many prisons and too many people in prison for petty crimes, such as drug users.

Maybe a better solution is to reinstate the firing squad and just shoot them.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here's a good story about a homeless guy that learned how to write programs and was successful.

<M/> commented: great story :D +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ban alcohol -- Oh wait, we already tried that and it didn't work. Oh well, ban it again, along with tobacco, fast food, french fries, candy, ice cream, etc. because they are all bad for us and can kill us.

<M/> commented: All in! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what did you enter for cyp? gets() doesn't accept spaces.

You should NEVER EVER use gets() because it can corrupt your program's memory when you enter more characters than the buffer can hold. Instead, use fgets(), such as fgets(cyp,sizeof(cyp),stdin); scanf() with "%s" has a similar problem, you can use "%149s" to limit input to 149 characters plus 1 for null terminator.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

clearly, Christmas is simply not tied to a religion, and thus, the state can have this federal holyday without violating church-state

That's not true here in USA. Here, Christmas is all about celebrating the birth of Christ, probably 75% of all Christmas music has Christ as it's theme.

Christians claim Christmas for themselves

It's called CHRISTmas for a reason. Name it something else if you don't think the holiday is all about Jesus Christ.

Happy Holidays is as good as any.

just like they claim marriage for themselves

Christians aren't the only ones -- I heard just the other day that India made gay sex/marriage illegal. It's also banned in other countries, like Russia.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

seems like im the only one with the error 2816

Or you are one of the few people still using Dev-C++, which hasn't been updated in many years. If you want to use MinGW then Code::Blocks is a lot better IDE than Dev-C++.

centenond commented: Code::Blocks works fine! thanks! +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I compiled your program with VC++ 2013 and only got one error, related to deprecated strcpy(). That error easily goes away by disabling error 4996

#pragma warning(disable: 4996)

line 37: strcpy(ls->name, "");

Why use strcpy() here? Just set the first character to 0. ls->name[0] = '\0';

If this is supposed to be c++, why are you using so many C constructs and functions? For example you should use new instead of malloc(), and you could substitute std::string for char*.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Instead of putting all those statements in one bit line separated by either || or && you should call them as individual statements.

 bool a,b,c,d,e,f;
 a = checklength(length);
 b = lowerCase(length,line);
 c = upperDate(length,line);
 d = beginLetter(length, line);
 e = correctDigits(length, line);
 f = specialChar(length, line);

 if( a || b || c || d || e || f)
 {
    // error
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Christmas has an interesting history. It was not a holiday in early America, and in fact was outlawed in Boston for a few years. Christmas didn't become a federal holiday in America until 1870. I anticipate one day in the not-too-distant future Congress will pass a law abolishing it as a federal holiday for political correctness.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'll write it for you but it will cost you $10,000.00 USD, full payment in advance.

Sara_6 commented: hhhhh,,, No way +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you recommend me to read MSDN ?

Yes, it's the official source for MS-Windows GUI. Also look for tutorials and examples. Microsoft has lots of example programs. And you will find lots of examples at CodeProject.com, which is probably the largest repository of free Windws example code that you will find on the internet.

learned most of their programming knowledge on Internet

That may be ok, for a hobbyist. Some people learn better and faster by reading books. If you have lots of time on your hands and don't mind spending hours and hours searching for answers that are easily found in a book, then do it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

To write a GUI using pure c++ is pretty difficult. Here is an into tutorial, and it only scratches the surface.

Writing Windows GUI programs is a lot simpler with other languages, such as CLR/C++, C# or VB.NET.

Here is a pretty good overview of .NET, and if you google for "what is .NET" you will find lots of other articles. In 10 words or less, .NET is a replacement for win32 api.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The only thing you need in getWord() is lines 22 and 23 of the code I posted. All the rest is just one-time initialization of the words vecor and can be put at the beginning of main().

You might want to pass the vector of words as a parameter to getWord()

As you can see, getWord() is nothing more than a one-line function.

std::string getWord(vector<string>& words)
{
   return words[rand() % words.size()];
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Failing to refresh the page before making changes causes a lot of problems. I've seen entire paragraphs disappear because I forgot to refresh before editing a post.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

something like below is what I have in mind. 2000 words should probably not be a problem.

#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include <ctime>
using namespace std;

int main()
{
    vector<string> words;
    ifstream in("filename.txt");
    if (!in.is_open())
    {
        cout << "Error opening file\n";
        return 1;
    }
    srand((unsigned int) time(0)); // seed the random number generator
    string word;
    while (in >> word)
        words.push_back(word);
    in.close();
    int n = rand() % word.size(); // get a random word
    string random_word = words[n];
    cout << "Random word is \"" << random_word << "\"\n";
    return 0;
}

Why are you converting the random word into a vector of single characters? It would be a lot simpler to just index into the std::string array.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do the assignment one small part at a time. First write a program that contains a loop which runs from 0 to 5. Then declare an array of 5 strings. Now your program is ready to prompt inside the loop for the strings, using the loop counter as the index into the array of strings.

Once you have finished that, you are ready for the next part of the assignment -- sorting the array of words. When you get that far, come back and we'll help you with it, assuming you still need help.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You're the one who called yourself a "love" doctor, not me. google "love doctor" and see what you find.

<M/> commented: Hitch... you will find Hitch ;) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Maybe he's bragging about how much sex he is getting :) Young men like to do that, whether it's true or not.

<M/> commented: I doubt it +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This seems to be a good source for English grammer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't see a goto statement -- where is it?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh no! Not another Elvis nutjob :) I don't know why people are so crazy over that truck-driver-turned-singer. He wasn't all that good of a signer, and a horrible actor. The final straw was when he died of drug overdose. Why would you want to memoralize someone like that???

If you want to dedicate your website to someone, dedicate it to Mother Teresa, someone who is worthy of it.

<M/> commented: Yeah... elvis is horrible. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Besides, I ain't no authority on nuthin :).

nitin1 commented: I am nitin, not nuthin. :D hehe +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

As deceptikon said, C language does not have a string data type. Instead, it uses character arrays. For example if you want it to hold the word "Hello" then the character array has to room to hold at least 6 characters -- 5 for "Hello" and another for the terminating character which is '\0';

char string[6];

This declares a character array named "string" that can hold 5 characters plus null-terminating character. You can name the array anything you want, it doesn't really matter as long as the name is unique (can't duplicate the name of something else in the program).

castajiz_2 commented: tnx for the additional reply +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Start here:

#include <iostream>

int main()
{
   // put your code here

}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

"Home Premium and lower editions can't connect to domains."

Ok, I was thinking of Windows 7 Pro. Sorry for misleading you. You will need to upgrade the computers from Home edition to Pro. And if you are going to do that you might as well upgrade them to Windows 8.1 Pro. There's a big of retraining needed but the learning curve isn't all that great.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Are the printers wifi ready? Or are they connected directly to computers? What operating systems are running on the 6 computers?

With MS-Windows 7/8 you don't really need a computer to act as a server, just set up a home network and all the computers on the network are considered servers which can share files and printers with each other.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Use a pointer and expand the array as needed. Better yet, use std::vector or std::list, both will auto expand for you. For example:

StudentList* Students; // pointer to an array

or

std::vector<StudentType> Students;