I'm a newbie teaching myself C, can anyone show me how to write a code that generates the next license plate number when you input one containing 6 characters 3 letters and 3 numbers, and asks the user if they want to continue or quit.
Thank you

Read these topics at the top of the forum.

Announcement: We only give homework help to those who show effort
Announcement: Please use BB Code and Inlinecode tags

I already did Salem

And yet your attempt at the problem remains invisible.
Stop me if I'm going to quickly for you to grasp this concept.

For the sake of argument, let's assume you can generate random numbers, but not random letters. Showing us that you can do that much would convince us that you're not an idle sponger trying to blag free homework.

I was just looking of ideas and clues on how to do it or understand how to go about it using a while loop, I'm just trying to learn how to write simple programs this is by no means some kind of homework. I'll take the post off if you think I'm that idle sponger.

I was just looking of ideas and clues on how to do it or understand how to go about it using a while loop, I'm just trying to learn how to write simple programs this is by no means some kind of homework. I'll take the post off if you think I'm that idle sponger.

He's not saying you are an idle sponger. He just wanted you to post code you've tried to prove you aren't.

Since you are dealing with characters, and each character is in fact just a number ('0'=48, '1'=49, ..., 'A'=65, ...) you can input your first value and, just like in math, add one to the rightmost character. Then , if the character was a number, test if it's above '9', and if it is reset it to '0' and add 1 to the next column. If a letter, test for 'Z'.


Start slow, write a small part (like the input and output), compile and test. Then add the calculation to the next plate number. Always add new functionality slowly, a step at a time and make sure it works before moving to the next step.

A clue.

for ( i = 0 ; i < 10 ; i++ ) {
  printf( "Next Plate=%06d\n", i );
}

We're now faced with the "goldilocks" problem, namely this answer falls into one of three categories. In other words, it's a 66% chance of being useless to you because you've failed to demonstrate what you know so far, and I've just wasted my time.
"Yeah thanks for nothing, I knew that already"
"Woah, back up Einstein, I'm new at this"
"Thanks, that's just what I needed"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.