• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

Koren

Member
I usually only load arguments into $a0 and rarely ever use $a1 directly
Well, you have a lot of leeway with assembly...

But I'm pretty sure the canonical way to compile
Code:
int sum(int x, int y) { return (x+y); }
would be
Code:
sum: add $v0, $a0, $a1
     jr $ra

Where are you loading the second argument of diadic functions?
 

zeemumu

Member
Well, you have a lot of leeway with assembly...

But I'm pretty sure the canonical way to compile
Code:
int sum(int x, int y) { return (x+y); }
would be
Code:
sum: add $v0, $a0, $a1
     jr $ra

Where are you loading the second argument of diadic functions?

I'm not working with those functions in assembly yet. I'm still slightly new to it.

But your example does help
 

gaugebozo

Member
It's C++? Only standard lib includes?

If so, I'd say yes, although I may add a compiling command as a comment at the beginning of the file.

I'd also specify the version (11, 14) if you use newer functions.


I'd say that it depends on which kind of job you're applying for. If it's for software development, I'd say style and possibly tests plays a role. If computing is a tool in the job, just a sane algorithm will probably be sufficient.
Thanks! Yep, standard library includes and computing is a tool. The title is Mathematician, so it would really just be using computing to varify probabilities with simulations.
 

Makai

Member
I feel stuck in C#/Unity and I'm getting stuck in VR. Companies and recruiters seem completely unwilling to hire me unless I have corporate experience in a specific framework. Like I even know Swift and have released several professional iOS apps, but my previous employers didn't use Cocoa so I'm out of the running.
 

balgajo

Member
Ideally you would cross-compile on a workstation rather than compiling directly on the device. It takes maybe an hour on a desktop.


You can always increase velocity by assigning larger point values to your stories. :)

Sorry for the ambiguity. I was generating the binaries from a worstation using a cross-compilation toolchain. Though shit took a while to be compiled...
:(
 

Ambitious

Member
Thanks.
So.. I just need to provide my personal information, then they will send me the contract. Yeah, it worked out. I've got the job.

The guy I talked to basically went through all the technologies they use and asked me to describe my experience with them, if any. He was satisfied with my level of experience and considered me a good fit for the company, so he would recommend to hire me. Barely five minutes later, the offer arrived.
He also said that my test result was "respectable".

The only bummer is the pay. For the first month, they're gonna hire me as an intern with a really low salary. If I do well, they're gonna hire me as a regular employee, but the salary range sounds like I'm gonna get less than at the other companies I applied at. Well, it's a shame, but I can only reiterate how amazing both the company and the job are. I will not pass up an opportunity like this.

Follow-up: This is now my fourth week, so I talked to the CEO today. They're happy with me and my work, and indeed, they're gonna hire me as a regular employee. Against my expectations, the salary he suggested is actually higher than at the other companies.

Fuck yeah.
 

peakish

Member
Follow-up: This is now my fourth week, so I talked to the CEO today. They're happy with me and my work, and indeed, they're gonna hire me as a regular employee. Against my expectations, the salary he suggested is actually higher than at the other companies.

Fuck yeah.
Great news! Grats!
 
Follow-up: This is now my fourth week, so I talked to the CEO today. They're happy with me and my work, and indeed, they're gonna hire me as a regular employee. Against my expectations, the salary he suggested is actually higher than at the other companies.

Fuck yeah.

Congratulations!
 

r1chard

Member
I just ran a PyCon (PyCon Australia) and it was exhausting but awesome. About 600 attendees all up :)

Just wish I was doing Python dev in my $dayjob instead of Javascript :-/
 
I'll be graduating after this year and I have some questions for anyone doing web development.

Most of my experience in school/internships has been with languages such as C#, C/C++, and Java. If I wanted to apply for a web position, should I be able to know both front end and back end development? To be honest, as a software engineer, I am more interested in the logic and making things work rather than making a site look nice. However, I am not sure what employees expect. Any advice? Should I learn how to build a site from the ground up, both front end and back end?
 

Somnid

Member
I'll be graduating after this year and I have some questions for anyone doing web development.

Most of my experience in school/internships has been with languages such as C#, C/C++, and Java. If I wanted to apply for a web position, should I be able to know both front end and back end development? To be honest, as a software engineer, I am more interested in the logic and making things work rather than making a site look nice. However, I am not sure what employees expect. Any advice? Should I learn how to build a site from the ground up, both front end and back end?

It's possible to do just one and on large sites it's common to separate those jobs, however, you will be much more constrained with job choices and quite frankly you will not be as good. As a good programmer, you shouldn't silo yourself and general front-end web is an exceedingly useful skill. You also seem to have the wrong idea about front-end web. In modern sites the interesting logic is all front-end, and the back is mostly just data mapping.
 

Kyuur

Member
Any experts with Regex here who can help me optimize the following statement? What I have so far is taking a few milliseconds with C++'s <regex>; it usually would be an done in initialization but it would nice to be able to more easily fit into a single 16ms frame too.

Code:
uniform\s+\S+\s+([^\[; ]+)
or uniform\s+[\w\d]+\s+(\w[\w\d]+)

Code:
uniform vec3    [B]oneUniform[/B];
uniform  TheStruct [B]aUniformOfArrayType[/B];
uniform    mat4 [B]matrixArrayUniform[/B][25];
uniform    TheStruct    [B]uniformArrayOfStructs[/B][10];
uniform vec3 [B]initialUniform[/B] = vec3(1.0, 0.0, 0.0);

Benchmarked the two above and the difference is usually of a couple hundred microseconds at most, favoring the latter or a combination of the two (with capture group being (\w[\w\d]+)).

Stuff is pretty cool and useful, much better that a list of looped string finds to get the same result. I just quickly learned the formatting yesterday using the great tutorial at RegexOne.
 
It's possible to do just one and on large sites it's common to separate those jobs, however, you will be much more constrained with job choices and quite frankly you will not be as good. As a good programmer, you shouldn't silo yourself and general front-end web is an exceedingly useful skill. You also seem to have the wrong idea about front-end web. In modern sites the interesting logic is all front-end, and the back is mostly just data mapping.

Maybe it would be good to start working on my web skills then. You're absolutely right that I could have the wrong idea about web, as I only really know a tiny amount of info from some of the people I work with. Thank you for your input.
 

JeTmAn81

Member
Any experts with Regex here who can help me optimize the following statement? What I have so far is taking a few milliseconds with C++'s <regex>; it usually would be an done in initialization but it would nice to be able to more easily fit into a single 16ms frame too.

Code:
uniform\s+\S+\s+([^\[; ]+)
or uniform\s+[\w\d]+\s+(\w[\w\d]+)

Code:
uniform vec3    [B]oneUniform[/B];
uniform  TheStruct [B]aUniformOfArrayType[/B];
uniform    mat4 [B]matrixArrayUniform[/B][25];
uniform    TheStruct    [B]uniformArrayOfStructs[/B][10];
uniform vec3 [B]initialUniform[/B] = vec3(1.0, 0.0, 0.0);

Benchmarked the two above and the difference is usually of a couple hundred microseconds at most, favoring the latter or a combination of the two (with capture group being (\w[\w\d]+)).

Stuff is pretty cool and useful, much better that a list of looped string finds to get the same result. I just quickly learned the formatting yesterday using the great tutorial at RegexOne.

I'm assuming you need to capture the info that's in the grouped sections, yes? If not, you could probably save some time by designating them as non-capture groups. Honestly, just read through everything on http://www.regular-expressions.info/. I've been doing that lately to try and complete my regex knowledge.
 

despire

Member
Hello everyone, new poster here. I've decided to start learning programming in hopes to get a job in the field someday. I've got a masters in Agricultural Sciences but the job market is really poor around here for the forseeable future so I figured to broaden my expertise.

Before my current education I studied something else for a year and did a course in C so I have some basic understanding about some stuff even though it was in 2008 and I've forgotten 95%.

I have access to the first year courses in the University here and I'm getting other course material from my friend in another school. I heard from a friend in the university that some people in the class were working after the first year of school. So the hope is to study this stuff myself and hopefully pick up enough skills to get a Junior position somewhere and go from there. Maybe apply for the university next year.

Is this a complete fools dream? My current job is pretty shitty so I'm kinda grasping at straws here.
 
Hello everyone, new poster here. I've decided to start learning programming in hopes to get a job in the field someday. I've got a masters in Agricultural Sciences but the job market is really poor around here for the forseeable future so I figured to broaden my expertise.

Before my current education I studied something else for a year and did a course in C so I have some basic understanding about some stuff even though it was in 2008 and I've forgotten 95%.

I have access to the first year courses in the University here and I'm getting other course material from my friend in another school. I heard from a friend in the university that some people in the class were working after the first year of school. So the hope is to study this stuff myself and hopefully pick up enough skills to get a Junior position somewhere and go from there. Maybe apply for the university next year.

Is this a complete fools dream? My current job is pretty shitty so I'm kinda grasping at straws here.
Without a degree its mostly about being able to prove that you know at least some things about programming. So you got to make a portfolio with finished applications to talk about during interviews and to have code samples they can look at.

Going through the first year courses at the university would be a great thing, as it gives you a structured way to pick up some basic programming and program design skills and also some knowledge of data structures and algorithms and big O and such things that companies really care about. Also, if you got enough self discipline go through MOOCs on Edx and Coursera. This is basically a CS degree but done completely with MOOCs.

Most importantly, take a look at what employers in your area request in terms of languages and learn those languages. Like where i live its all Java, C# and PHP, so learning C or python would be a waste of time.
 
I'm not getting how this works. It reverses a C-style string.

Code:
void reverse(char *str) {
char * end = str;
char tmp;
if (str) {
while (*end) {
    ++end;
}
--end;
while (str < end) {
    tmp = *str;
   *str++ = *end;
   *end-- = tmp;
}
}
}

So if I pass the string "Hello" to this function.

end points to the array [H, e,l,l,o, null].

Now I believe the while(*end){++end} bit basically iterates the pointer until it points to the null terminating character in the char array. That's why --end is there after the loop, so that we now point at "o".

Ok so far so good (I hope). Then we have... while str < end. Which I don't get. When will that condition evaluate to false?

Anyway now we set tmp to *str... which I assume would be "H"? So tmp = "H"?
And then *str++ = *end. Which in my mind would swap the "e" and "o" (*str is the starting address of the char array, which would be "H". So isn't *str++ the second letter?). Which makes no sense.

Clearly I'm missing something.
 

Koren

Member
Now I believe the while(*end){++end} bit basically iterates the pointer until it points to the null terminating character in the char array. That's why --end is there after the loop, so that we now point at "o".
That's correct.

Then we have... while str < end. Which I don't get. When will that condition evaluate to false?
str is a pointer to a character, at the beggining the first one of the string. You compare the addresses. So, it's "while end points to a character that is after the character pointed by str".

The idea is to:
- switch the characters pointed by str and end
- move str one character forward
- move end one character backward
- go back to 1 is there's still characters between str and end

Anyway now we set tmp to *str... which I assume would be "H"? So tmp = "H"?
Yes

And then *str++ = *end. Which in my mind would swap the "e" and "o" (*str is the starting address of the char array, which would be "H". So isn't *str++ the second letter?).
Not swap.

That means:
- get the character pointed by end (that would be o) (then *end part)
- store the character at the adress str (you have now oello) (the str* = ... part)
- increase str (the ++ part, post-increment)

Then *end-- = tmp means:
- copy the character in tmp at the address end (you have oellH)
- decrease end

Now, str points toward e and end towards the second l

tmp will receive e
*str++ = *end will copy the second l at the second place, getting olllH, and increase str
*end-- = tmp will put back the e (to get olleH) and decrease end

Now str < end is false (since str = end) so you exit the loop
 

Erudite

Member
Hey Programming GAF, I'm looking for some career advice.

I'm in my 4th year of my B. Sc. Computer Science (my second B. Sc.), and due to unforeseen financial circumstances, have started applying for internships/entry level jobs.

I got a phone call this morning with this company FDM Group, and they said they did not require me to graduate with my CS degree in order to fulfil this entry level position (as long as I have experience with OOP), which would require me to fly across country to receive training (which I'm willing to do) and hold me to a contract of 2 years.

I have two semesters left before I graduate with my CS Degree, and I'm currently enrolled for the Fall semester, which would start next week. I have enough money saved up that I can pay for tuition to complete my degree, but it would mean digging into my savings.

I'm also waiting to hear back about setting up an appointment for a technical interview with a different company that might eventually lead to an internship from early January to late June.

Right now I'm thinking of taking the first aforementioned opportunity, stopping my schooling and flying across the country to be trained and work for FDM, both for financial reasons and also greater interest in learning in a practical setting out in the industry as opposed to academia (since I've been at Uni since 2010).

I'm wondering if it's shortsighted of me to drop finishing my degree to go work and learn out in the field? Would it prohibit me from future opportunities that I didn't finish my degree, but have practical experience with this company (assuming I got the position)?
 
Read up on post-fix versus pre-fix increment.

That's correct.

That means:
- get the character pointed by end (that would be o) (then *end part)
- store the character at the adress str (you have now oello) (the str* = ... part)
- increase str (the ++ part, post-increment)

Ah I get it. Thanks for the explanation Koren. And that's interesting Zoe. I have to be more careful about that.
 
Hey Programming GAF, I'm looking for some career advice.

I'm in my 4th year of my B. Sc. Computer Science (my second B. Sc.), and due to unforeseen financial circumstances, have started applying for internships/entry level jobs.

I got a phone call this morning with this company FDM Group, and they said they did not require me to graduate with my CS degree in order to fulfil this entry level position (as long as I have experience with OOP), which would require me to fly across country to receive training (which I'm willing to do) and hold me to a contract of 2 years.

I have two semesters left before I graduate with my CS Degree, and I'm currently enrolled for the Fall semester, which would start next week. I have enough money saved up that I can pay for tuition to complete my degree, but it would mean digging into my savings.

I'm also waiting to hear back about setting up an appointment for a technical interview with a different company that might eventually lead to an internship from early January to late June.

Right now I'm thinking of taking the first aforementioned opportunity, stopping my schooling and flying across the country to be trained and work for FDM, both for financial reasons and also greater interest in learning in a practical setting out in the industry as opposed to academia (since I've been at Uni since 2010).

I'm wondering if it's shortsighted of me to drop finishing my degree to go work and learn out in the field? Would it prohibit me from future opportunities that I didn't finish my degree, but have practical experience with this company (assuming I got the position)?
Finish your degree. You will always regret stopping so close to the end.
 

Kalnos

Banned
I was browsing the ArenaNet careers page, and saw a posting for Programmer Intern.

https://www.appone.com/maininforeq.asp?Ad=389217&R_ID=1356238&Refer=https://www.arena.net/&B_ID=44

The $14/hr pay seems really, really low for a developer job, even in gaming. I was paid more in a non-technical QA role at a small company.

Is this normal and does it reflect what I should expect in full-time positions as well (e.g. well below market value).

About 8 years ago I got $14/hr when I started at my co-op but that was in Louisville, KY and not Bellevue, WA. I would say that it isn't unusual to make something like that for an internship, you aren't really going to be very productive until the end of your tenure to be honest. You would be making much more ($50k+ depending on where the company is) after graduating. If you're looking to get into game development that's a great opportunity.
 
Finish your degree. You will always regret stopping so close to the end.
Agreed. To be honest, them stating they don't need you to finish your degree and basically encouraging you to drop out shows me that they give zero fucks about your long term career prospects; they likely want to fill some low level grunt position where you'll hardly be valued.
 

Regiruler

Member
I'm taking a C++ intro class, coming from years of java and a bit of Python. On my own I figured out how to use a goto.

CoQqeFqVIAAQGUh.png
THIS IS WHAT UNLIMITED POWER FEELS LIKE
CoQqeFqVIAAQGUh.png
 

vypek

Member
I'm taking a C++ intro class, coming from years of java and a bit of Python. On my own I figured out how to use a goto.

Its been a long time since I have done anything with C++ and I'm certainly not the greatest programmer but I remember it being pounded into my head to never use goto and there should be a way to accomplish what you are doing without it.

Someone correct me if I'm wrong.
 

Koren

Member
Really? You finally have complete control of memory
You have limited control about a part of a virtual memory...

Granted, that's far more than in most other languages, but complete control... Nah, definitively not.

Its been a long time since I have done anything with C++ and I'm certainly not the greatest programmer but I remember it being pounded into my head to never use goto
You'll hear different opinion on this like many other things... That's a common one, but I hate strict rules, there's probably always an exception that make more sense than the rule.

If you think most people loathe goto in C, look at setjmp ;)

there should be a way to accomplish what you are doing without it.
It's only valid if there is always a better* way to accomplish what you're doing without it. If you do something in a worse way for the sake of not using something, I'd say you're doing it wrong, I think.

(*) and unfortunately, "better" is subjective...

And that could be an argument to forbid pretty much everything (hell, you don't need functions, there's a way to accomplish what you want without those ;) )
 
T

thepotatoman

Unconfirmed Member
Hey Programming GAF, I'm looking for some career advice.

I'm in my 4th year of my B. Sc. Computer Science (my second B. Sc.), and due to unforeseen financial circumstances, have started applying for internships/entry level jobs.

I got a phone call this morning with this company FDM Group, and they said they did not require me to graduate with my CS degree in order to fulfil this entry level position (as long as I have experience with OOP), which would require me to fly across country to receive training (which I'm willing to do) and hold me to a contract of 2 years.

I have two semesters left before I graduate with my CS Degree, and I'm currently enrolled for the Fall semester, which would start next week. I have enough money saved up that I can pay for tuition to complete my degree, but it would mean digging into my savings.

I'm also waiting to hear back about setting up an appointment for a technical interview with a different company that might eventually lead to an internship from early January to late June.

Right now I'm thinking of taking the first aforementioned opportunity, stopping my schooling and flying across the country to be trained and work for FDM, both for financial reasons and also greater interest in learning in a practical setting out in the industry as opposed to academia (since I've been at Uni since 2010).

I'm wondering if it's shortsighted of me to drop finishing my degree to go work and learn out in the field? Would it prohibit me from future opportunities that I didn't finish my degree, but have practical experience with this company (assuming I got the position)?

I'm personally in the middle of a 4 year project I dropped out of college to do, so I guess I was on the side to get your experience while you can, finish college later if need be.

Can't really say if it was good or bad until after the project is over I guess. I know I currently enjoy it a lot more than college at least.
 
I need help getting started on this: unsigned int a,b and a>0, b>0, we can get a+b < a
I know I need to prove this in terms of bits. For example, 7 (in 3 bits is 111) + 1 (in 3 bits is 001) = 0 (000), so 7 + 1 < 7 => 0 < 7

I'm not sure where to start in coding this.
 

Koren

Member
I need help getting started on this: unsigned int a,b and a>0, b>0, we can get a+b < a
I know I need to prove this in terms of bits. For example, 7 (in 3 bits is 111) + 1 (in 3 bits is 001) = 0 (000), so 7 + 1 < 7 => 0 < 7

I'm not sure where to start in coding this.
What do you need exactly? Code or formal proof?

For formal proof, the idea is to show that the dropped high power bit, when removed, remove more than b to the result since b < 2^n (n being the number of bits of the representation used) :

Assuming an unlimited number of bits for the result of additions, you can show that :

1) a+b < a+2^n (where n is the number of bits)

2) if a+b > 2^n, then 0 < a+b-2^n < a

3) 0 < a+b < 2^(n+1)

4) if a+b > 2^n, then storing the result on n bits means that a+b is changed into a+b-2^n

5) then conclude using 2)


For code, you want all values of a and b? Or an example of a and b that works?
 
What do you need exactly? Code or formal proof?

For formal proof, the idea is to show that the dropped high power bit, when removed, remove more than b to the result since b < 2^n (n being the number of bits of the representation used) :

Assuming an unlimited number of bits for the result of additions, you can show that :

1) a+b < a+2^n (where n is the number of bits)

2) if a+b > 2^n, then 0 < a+b-2^n < a

3) 0 < a+b < 2^(n+1)

4) if a+b > 2^n, then storing the result on n bits means that a+b is changed into a+b-2^n

5) then conclude using 2)


For code, you want all values of a and b? Or an example of a and b that works?

I think both would be nice just to understand what I need to do. I want to prove it in code but I don't know where to begin. I was wondering where should I start? The example of a and b that works. Also, can it be proven in 8 bits?

Here's what I have so far but it's just an idea.

code said:
int main()
{
unsigned int i = 7, j = 1;

cout << "a + b = "<< bitset<3> (i+j) << " < " << i << endl;
}
 

Koren

Member
I'm still not sure I understand what you're after ^_^ Your example works and the program too, no? (although I wonder why you used i and j instead of a and b, that doesn't help readability, I'd say)

Any a>0 will work, and any b in [2^n-a, 2^n-1]

For 3 bits:

1 + 7 = 0 < 1
2 + 6 = 0 < 2
2 + 7 = 1 < 2
3 + 5 = 0 < 3
3 + 6 = 1 < 3
3 + 7 = 2 < 3
4 + 4 = 0 < 4
4 + 5 = 1 < 4
4 + 6 = 2 < 4
4 + 7 = 3 < 4
5 + 3 = 0 < 5
5 + 4 = 1 < 5
5 + 5 = 2 < 5
5 + 6 = 3 < 5
5 + 7 = 4 < 5
6 + 2 = 0 < 6
6 + 3 = 1 < 6
6 + 4 = 2 < 6
6 + 5 = 3 < 6
6 + 6 = 4 < 6
6 + 7 = 5 < 6
7 + 1 = 0 < 7
7 + 2 = 1 < 7
7 + 3 = 2 < 7
7 + 4 = 3 < 7
7 + 5 = 4 < 7
7 + 6 = 5 < 7
7 + 7 = 6 < 7
 
I'm still not sure I understand what you're after ^_^ Your example works and the program too, no? (although I wonder why you used i and j instead of a and b, that doesn't help readability, I'd say)

Any a>0 will work, and any b in [2^n-a, 2^n-1]

For 3 bits:

1 + 7 = 0 < 1
2 + 6 = 0 < 2
2 + 7 = 1 < 2
3 + 5 = 0 < 3
3 + 6 = 1 < 3
3 + 7 = 2 < 3
4 + 4 = 0 < 4
4 + 5 = 1 < 4
4 + 6 = 2 < 4
4 + 7 = 3 < 4
5 + 3 = 0 < 5
5 + 4 = 1 < 5
5 + 5 = 2 < 5
5 + 6 = 3 < 5
5 + 7 = 4 < 5
6 + 2 = 0 < 6
6 + 3 = 1 < 6
6 + 4 = 2 < 6
6 + 5 = 3 < 6
6 + 6 = 4 < 6
6 + 7 = 5 < 6
7 + 1 = 0 < 7
7 + 2 = 1 < 7
7 + 3 = 2 < 7
7 + 4 = 3 < 7
7 + 5 = 4 < 7
7 + 6 = 5 < 7
7 + 7 = 6 < 7

output said:
i+j = 000 < 7

I wanted to prove that in terms of coding which I'm after. I don't have any idea on how to show the list of possibilities of a + b < a, the one you've just listed now, in terms of coding. Especially converting an integer into bits, the one I posted prints out the addition of i + j which results to 000 in bits but not sure it would be best to have it printed out in bits instead of an integer. Like instead of i + j = 000 < i = 7, it should be i + j = 0 < i = 7

Sorry if what I'm asking is not clear.
 

Koren

Member
I wanted to prove that in terms of coding which I'm after. I don't have any idea on how to show the list of possibilities of a + b < a, the one you've just listed now, in terms of coding. Especially converting an integer into bits, the one I posted prints out the addition of i + j which results to 000 in bits but not sure it would be best to have it printed out in bits instead of an integer. Like instead of i + j = 000 < i = 7, it should be i + j = 0 < i = 7
If you want to convert a 32-bits unsigned integer into a 3-bits unsigned integer (but still have it as an unsigned integer), you can use "&0b111"

Code:
cout << "a + b = "<< (i+j) & 0b111 << " < " << i << endl;

It's a logical AND that, here, only keep the last 3 bits of the result, like an overflow on 3-bit numbers would behave.
 
If you want to convert a 32-bits unsigned integer into a 3-bits unsigned integer (but still have it as an unsigned integer), you can use "&0b111"

Code:
cout << "a + b = "<< (i+j) & 0b111 << " < " << i << endl;

It's a logical AND that, here, only keep the last 3 bits of the result, like an overflow on 3-bit numbers would behave.

I'm getting an error stating "invalid operands of types 'int' and 'const char [4]' to binary 'operator<<'"
 
Sorry, make it



I keep forgetting << has priority over & in this case... Makes sense when it's a shift, but I find it annoying for couts...

Thank you. Much appreciated for helping me out. Is there a way to output negative integer using "0bxxx"?
Nvm, I just put a negative sign in front like this -((a+b)&0bxxx).
 

Sandfox

Member
I'm having issues with writing up code to find every permutation of a string. I understand the algorithm conceptually, but can't process it as code. All of the videos on youtube about the subject seem iffy too.
 

Koren

Member
I'm having issues with writing up code to find every permutation of a string. I understand the algorithm conceptually, but can't process it as code. All of the videos on youtube about the subject seem iffy too.

Easy...
[ "".join(g) for g in itertools.permutations(my_string) ]

More seriously, if you're looking for help, having the language would help.

As for the algorithm, is this the one that produce all the permutations in increasing order?
 
I have two questions. How do I show correct and incorrect digits when printing out a decimal value that has 20 digits? How to display ascii table in 3 columns?
 
Top Bottom