![]() |
C languege (auto ganerate number)
How to use C languege to auto generate number???
example: 1001 1002 than 1st number is fit(1002) by not using this matter: Code:
int id=101; |
Re: C languege (auto ganerate number)
The question isn't clear. C does not automatically generate numbers, you have to write code to produce a given output from a specific input. Can you give an example of what input you want the program to use (if any), and what output you want the computer to print?
Why would you not want to declare and increment an integer? It seems those would be fairly essential operations, although this does depend on what output you want the program to produce. |
Re: C languege (auto ganerate number)
Quote:
question is"Airline Resevation System" question saying that "*IDs are auto generated" example: customer ID* customer name gender 1001 David Tan M 1002 Jenny Lim F this is my second assignment in my 1st assignment i are using "increment method" but my tutor has saying that is wrong !!! than i ask him how to do (auto generated) he answer me: i jz can gv you explaintion, assignment need do by yourself i tech you before !!!than i go find the note but cant get it!!! this is my 1st assignment: question: The airline company, KL AIRLINE, has engaged your teanm to develop a new Airline Ticket Reservation System....airplane wiyh the occupancy of "20 passengers". !.display the KL "Airline Reservation Menu" for the user to select from 2 main options which are to do "Booking" and "display seat layout & occupancy".thr is one last option -to "exit" from the system after displaying an appropriate farewell message. 2.Booking -ask user for yhe number of seat required -Generete the Booking ID(if enough seats are available) -for each seat required, *ask for the passenger name, *assign the booking ID to the seat, and *display the ticket in following format: ------------------------------------------------------------------------------------- | --KL airline booking tikcket---- | | booking ID:100 Flight No.:AK65 | | Passenger:XXXXXXXXX Date :25-12-2008 | | Time :23:45 | | Gate :G9 | | seat No :3B | --------------------------------------------------------------------------------------- note:-( Flight No,Date,Time,Gate )will be initizalized either during compile-time or run time.the details are to be stored in a "Struture variable" -hv all the necessary "validation" in place, including useful messages, "not enough seat available" - must use a Two Dimensional Array to store the seat information(the booking ID or a Zero value). 3.display seat layout & Occupancy sample: A B C D E |--------------------------------------------| 1 |101 | 101 | 101 |102 | 103 | |-------------------------------------------| 2 |103 |104 |104 |104 |0 | |-------------------------------------------| | Aisle | |-------------------------------------------| 3 | 0 | 0 | 0 | 0 | 0 | |-------------------------------------------| 4 | 0 | 0 | 0 | 0 |0 | |-------------------------------------------| answer Code:
#include<stdio.h> |
Re: C languege (auto ganerate number)
Can't see what's wrong with the id++ part. It's not stored anywhere as far as I can see.
Interesting use of recursion. Are you sure you really know why you've used it in that way? Good use of single character variable names. I haven't got a clue what the code is doing; the intent is absolutely impossible to determine. Very good for job security, that. What doesn't the program do that you want? Apart from the autogenerated ID, that is. |
Re: C languege (auto ganerate number)
thx i know ald
Code:
/* RAND.C: This program seeds the random-number generator |
Re: C languege (auto ganerate number)
M gn stp sng cplt wds, th u l cn c w fkn dft t s 2 wk t wt h fk u n bt.
|
Re: C languege (auto ganerate number)
Gg, o gdu xi eo'u J () tuq toh wxmt muhuis oe () odsnou di muus c o? Decode THAT!
|
Re: C languege (auto ganerate number)
Absolutely, I don't think that I understand what you said all.
Due to my understand It's my answer: You can use a large number begin with 1 ex: id = 1000; And after that you can general other number so that it's less than id ex: id2 = rand()%id; And finally you can sum both of them ex: result = id + id2; |
| All times are GMT +5.5. The time now is 01:59. |