Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!

cracked.io | Best Forum Around | Free Premium Accounts




 2887

Could anyone help me? Trying to code a number generator...

by D E A D L Y - 09 April, 2019 - 02:17 PM
This post is by a banned member (D E A D L Y) - Unhide
180
Posts
70
Threads
5 Years of service
#9
(09 April, 2019 - 06:21 PM)atiufi Wrote: Show More
(09 April, 2019 - 05:32 PM)Dragonslayer3242 Wrote: Show More
(09 April, 2019 - 04:42 PM)atiufi Wrote: Show More
here i made a picture from my code that i did just now i did not know the code command to paste it in the post thats why i post a imgur link and its on C because i did not learn C# but maybe it will help you

https://imgur.com/a/QHh7WEq
the random command works different on C then on C# if i use the rand command it generates a random number from the int value thats why i wrote rand()%10 so it only generates 0-9
the first 3  segements i just printed because they are fixed anyway and the for-loop is for how much random numbers you need and if-statement is if the forth number is generated print a ":"
and the first command after int main is just because if i start the program it has a fixed seed that means the random generated numbers are always the same if i dont change the seed thats the command for it.
sry my english typing is so bad hopefully you understood it a little more with my C code
maybe you can adapt this to C#

and that was also training for me never used the random command :D
Thank you, ill take a look, this is what I got so far: https://imgur.com/Cx9j7Ob

Still seems I cant figure it out, basically I am pretty sure I know what to do but just dont.
for (int i = 0; i < 4; i++)
           {
               numbers[i] = rand.Next(1000, 10000); ( I need this to be like 1000, 2000, 3000, 4000 ) but I dont need to use rand.net but not sure what to use
           }

another imgur link
the site blocks my for loops because it thinks i try sql injection xD

https://imgur.com/a/IsVemLo

make a new int and increase it with thousand because you rand.next command will input a number from 1000 to 10000 so it can also be 1232 for example
I dont think this will work, because it needs to be exactly this format: 6006491266305597 < Exact same then next 3 has to be randon, then the :pin has to be different numbers.
I love people :)
This post is by a banned member (Itamai) - Unhide
This post is by a banned member (D E A D L Y) - Unhide
180
Posts
70
Threads
5 Years of service
#11
(09 April, 2019 - 08:20 PM)atiufi Wrote: Show More
(09 April, 2019 - 08:02 PM)Dragonslayer3242 Wrote: Show More
(09 April, 2019 - 06:21 PM)atiufi Wrote: Show More
another imgur link
the site blocks my for loops because it thinks i try sql injection xD

https://imgur.com/a/IsVemLo

make a new int and increase it with thousand because you rand.next command will input a number from 1000 to 10000 so it can also be 1232 for example
I dont think this will work, because it needs to be exactly this format: 6006491266305597 < Exact same then next 3 has to be randon, then the :pin has to be different numbers.

okay then do it like my first imgur pic. the fixed numbers you will save in a segment like s1=6006 s2=4912 and so on then print them and after that you can use the random command in a for loop and print them in every loop and if the loop printed the 3 number print a ":" and that should be it ^^ you can also use the same code like me in C# i guess
Not sure how c works but its somewhat the same at C#, but I did exactly what ur code was then edit a bit, I got it working what I liked, but its not doing more then 1 number, any ideas?
I love people :)
This post is by a banned member (Itamai) - Unhide
This post is by a banned member (Translate) - Unhide
This post is by a banned member (D E A D L Y) - Unhide
180
Posts
70
Threads
5 Years of service
#14
(This post was last modified: 10 April, 2019 - 03:36 PM by D E A D L Y.)
(09 April, 2019 - 10:55 PM)atiufi Wrote: Show More
(09 April, 2019 - 08:59 PM)Dragonslayer3242 Wrote: Show More
(09 April, 2019 - 08:20 PM)atiufi Wrote: Show More
okay then do it like my first imgur pic. the fixed numbers you will save in a segment like s1=6006 s2=4912 and so on then print them and after that you can use the random command in a for loop and print them in every loop and if the loop printed the 3 number print a ":" and that should be it ^^ you can also use the same code like me in C# i guess
Not sure how c works but its somewhat the same at C#, but I did exactly what ur code was then edit a bit, I got it working what I liked, but its not doing more then 1 number, any ideas?

https://imgur.com/a/1g2RU2k

you could also to another function with the whole code and call it in the main function but i was too lazy for that :D
you first give a number how much keys you want generated and then the whole generating process you put that in a for loop so it repeats int o is the same as int i but you cant use int i on the first for loop so i needed to make another one.
but there are probably much easier ways to do that i think did your teacher or professor not give you tips or something? ^^
because our professor wrote a programm, talked about it and then we need to do the same program but with slightly difference so we dont copy his code

scanf is for input so the program waits for a value to proceed the program


and in scanf its &codes because we  need to give codes the address of the value from 5(on my screenshot) we cannot just give the value to codes
hmm I see, yeah well this is my "first" assignment I guess is what you can call it, he basically did 20 mins of talking about the language, then said here try it and its due by friday. He said he "wanted" to know how far or how much we know about coding, which would of been fine if its something I know, which all languages are somewhat similar but kinda different. The way you put it makes it more simple, ima take a look and retry, ill let you know how it goes.


EDIT: I freaking did it, I love you all so much, I did do it a little different but it help me learn some knowledge, its amazing the community. @atiufi you're truly amazing.
I love people :)

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 1 Guest(s)