In the middle of a c++ test

in the middle of a c++ test
can Veeky Forums solve these for me?
i'm failing uni btw

managed to solve 3.4

cya later brainlet

>Final-Inc_S2_2015 - Google Docs

I'm told Google is a highly prestigious university.

If you're being asked to code on paper you should sue them for malpractice.

I was asked to do this and I go to a pretty good university for CS/Software Eng. I don't think it's that uncommon.

anyways sage for academic dishonesty

Yeah same here. It wasn't very difficult though, I mean compared to the insane amount of homework.

You literally just count the elements [math]e[/math] for which [math]e \,\equiv\, 45 \qquad\left( \mathrm{mod}\; 100\right)[/math] you fucking brainlet.

I'm glad the average code monkey isn't as much of a catastrophe as you.

The university I go to is one of the top in the world for CS and we have to code on paper for exams

Homework is supposed to be difficult. Exams are supposed to be easy because it's the only way to guarantee you won't cheat, given the limited amount of time.

Also, based on the questions on your exam, these questions belong to a first semester programming class. If you're failing your university, much less your programming classes by now, consider dropping out and joining a trade school.

>The numbers 645, 945, and 10045 start with 45.

This is why all computer scientists are brainlets.

>numbers that start with 45
>numbers 645, 945, 10045 start with 45

BEEEEP. Incorrect. Number 645 starts with 6, 64, or 645. Number 945 starts with 9, 94, or 945. Number 10045 starts with 1, 10, 100, 1004, or 10045.

well if the prof defined "start with" here as he did, then it's not wrong
i think he chose that definition just to make the problem easier
e.g. if(X % 100 == 45) ...

>limited amount of time.
>2 - 3 hours is very limited

>mathematician is incorrect
>spew some disgusting math jargon in an infantile attempt to confuse opposition

Nah. Get out. It's incorrect. Numbers 645, 945, and 10045 do not start with 45. They do contain number 45 though.

>God, I spent 30 minutes on this assignment, how can you tell me I'm lazy!?

Just get the fuck out sperglord, nobody gives a shit.

>be mathematician
>somebody spots error in your filthy useless work
>"Nobody gives a shit! I swear!"

is this bait? perhaps you not actually know anything about programming?
== is the comparison operator to check that two values are the same, whereas = is the assignment operator to give a variable a value
% is the modulus operator, where x%y == z is generally written mathematically as x ~ z (mod y) (and read "x is congruent to z modulo y). what this means is that y divides (x-z).
finally, the "if" statement is used to indicate that a certain bit of code should be executed if a certain condition holds true. in this case, that condition is if X%100 == 45, i.e. if the first two digits of X (as the prof defines them) are 45.

also, there is a general consensus on what it means for a number to start with Y, but the professor indicated that he would be using a different definition for the exam. there is nothing here to get upset about.

This honestly, desu... Coding on paper is a great way to actually see if you know how to program.

>basement mathematician thinks he knows what "start" means when it can clearly mean up to two things, one of which is specified in the text
Don't you have the sum of whole numbers to add up?

Nope. 'Start' is never used in any context to mean 'contain'. Go away troll. You were incorrect. You were corrected.