Simple challenge for a beginner

Posts 1–10 of 10 · Page 1 of 1
Simple challenge for a beginner
Okay hey! I am making this thread just to ask if one of you guys could give a simple challenge which could easily be done by a newbie. When I mean simple I mean simple but nothing too simple like "Make a calculator that adds" I would like something along the lines of "Make an data bank, so that it asks you for all your details and then shows them all at the end" Yes I know that seems simple but that's like the level I am on lol.


 
Thoughts
In fact I'm going to make that then copy code and post it here and you could maybe give me some tips, edit/simply as well as give me challenges.
You should try to solve algorithm problems like I've done when I started.


My challenge for you is to write a program that ask for an integer parameter (must be n>=0) and then it prints n prime numbers.


This one is low difficult but if your level is the one said before, it will be a real challenge
Quote Originally Posted by Sixx93 View Post
You should try to solve algorithm problems like I've done when I started.


My challenge for you is to write a program that ask for an integer parameter (must be n>=0) and then it prints n prime numbers.


This one is low difficult but if your level is the one said before, it will be a real challenge

Yeah, It looks difficult for me LOLOL but I'll try and post the code here.
I hope you are doing it the right away... Have you worked with arrays? pointers? etc? What do you already know?

We kinda need to know so we can give you a challenge decent for you.

Anyway, I think that trying to create all kinds of sorting algorithms is a good way to improve your logic.

https://en.wikipedia.org/wiki/Sorting_algorithm

You have an explanation of each algorithm there. Also, somewhere on the wiki you can find code for each one on different languages. (try to do it yourself first)
Quote Originally Posted by 'Bruno View Post
I hope you are doing it the right away... Have you worked with arrays? pointers? etc? What do you already know?

We kinda need to know so we can give you a challenge decent for you.

Anyway, I think that trying to create all kinds of sorting algorithms is a good way to improve your logic.

https://en.wikipedia.org/wiki/Sorting_algorithm

You have an explanation of each algorithm there. Also, somewhere on the wiki you can find code for each one on different languages. (try to do it yourself first)
Well I get the theory behind array's but I haven't touched pointers. I just realized I completely forgot about the if statement lol.
Quote Originally Posted by Pillows and Poo View Post

I just realized I completely forgot about the if statement lol.
That's strange... It's hard to code something without any if statement. Imho.
Quote Originally Posted by Sixx93 View Post
That's strange... It's hard to code something without any if statement. Imho.
Yeah I'm suprised too. I guess I was just doing some random shit with cout's and cin's lol.
Quote Originally Posted by Pillows and Poo View Post


Yeah I'm suprised too. I guess I was just doing some random shit with cout's and cin's lol.
Deep within of the depths of your prized processor lies a deep dark world of branch misunderprediction aliasing. Only the truly brave among us delve into the art of branch misunderprediction correction. Take the following branching misdirection ratification algorithm in a disassembly:
Code:
0151A182   C74424 20 5AC2F7>MOV DWORD PTR SS:[ESP+20],FDF7C25A
0151A18A   60               PUSHAD
0151A18B   C60424 7C        MOV BYTE PTR SS:[ESP],7C
0151A18F   C74424 3C 9D7AC9>MOV DWORD PTR SS:[ESP+3C],3C97A9D
0151A197   C64424 04 20     MOV BYTE PTR SS:[ESP+4],20
0151A19C   886424 10        MOV BYTE PTR SS:[ESP+10],AH
0151A1A0   885424 04        MOV BYTE PTR SS:[ESP+4],DL
0151A1A4   8D6424 3C        LEA ESP,DWORD PTR SS:[ESP+3C]
0151A1AD   0000             ADD BYTE PTR DS:[EAX],AL
0151A31F   76 61            JBE SHORT 0151A382
At the end lies an JBE instruction, which is conditional branching, and thus the branch predictor will predictor the branch. Now herein lies the branch misunderprediction issue. As the cpu metaparses the binary inputs, the CPUID causes a hash collision between the RTDSC processor sector and the physical memory branch analysis sector. This is because the JBE instruction has been incorrectly cached by ring -1 IO input ports. The only way to correct this inherent flaw in x86 micro architecture algorithms in via wasting several clock cycles to save several hundred. The most logical way to construct a fix is via 500 or greater NOP instructions in sequence. Below i will post a preprocessor macro that should be placed in the if block of conditional statements about 5 times to exponentially increase performance. I'm talking an FPS increase of 20 to 300 type performance boost.
Code:
 #define GOFASTLOL for(int i = 0; i < 500; i++) { __asm{ NOP } }
TLDR: Put that ^ in your code it go vroom vroom
Quote Originally Posted by Saltine View Post

Deep within of the depths of your prized processor lies a deep dark world of branch misunderprediction aliasing. Only the truly brave among us delve into the art of branch misunderprediction correction. Take the following branching misdirection ratification algorithm in a disassembly:
Code:
0151A182   C74424 20 5AC2F7>MOV DWORD PTR SS:[ESP+20],FDF7C25A
0151A18A   60               PUSHAD
0151A18B   C60424 7C        MOV BYTE PTR SS:[ESP],7C
0151A18F   C74424 3C 9D7AC9>MOV DWORD PTR SS:[ESP+3C],3C97A9D
0151A197   C64424 04 20     MOV BYTE PTR SS:[ESP+4],20
0151A19C   886424 10        MOV BYTE PTR SS:[ESP+10],AH
0151A1A0   885424 04        MOV BYTE PTR SS:[ESP+4],DL
0151A1A4   8D6424 3C        LEA ESP,DWORD PTR SS:[ESP+3C]
0151A1AD   0000             ADD BYTE PTR DS:[EAX],AL
0151A31F   76 61            JBE SHORT 0151A382
At the end lies an JBE instruction, which is conditional branching, and thus the branch predictor will predictor the branch. Now herein lies the branch misunderprediction issue. As the cpu metaparses the binary inputs, the CPUID causes a hash collision between the RTDSC processor sector and the physical memory branch analysis sector. This is because the JBE instruction has been incorrectly cached by ring -1 IO input ports. The only way to correct this inherent flaw in x86 micro architecture algorithms in via wasting several clock cycles to save several hundred. The most logical way to construct a fix is via 500 or greater NOP instructions in sequence. Below i will post a preprocessor macro that should be placed in the if block of conditional statements about 5 times to exponentially increase performance. I'm talking an FPS increase of 20 to 300 type performance boost.
Code:
 #define GOFASTLOL for(int i = 0; i < 500; i++) { __asm{ NOP } }
TLDR: Put that ^ in your code it go vroom vroom
Fakakakakakakakakakaa
Posts 1–10 of 10 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us