[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 8 KB, 430x304, 1271572207591.gif [View same] [iqdb] [saucenao] [google]
[ERROR] No.3678208 [Reply] [Original]

Any Computer Scientists here? Need some help with a cpp crogram.

>> No.3678212

>>3678208
program rather

>> No.3678217

If it's somewhat basic, I can probably help.
What's the problem?

>> No.3678224

if not here check >>>/g/.

>> No.3678222

elaborate

>> No.3678242

>>3678208
Problem;
Suppose an employee gets paid every two weeks and earns %1700.00 each pay period. In a year the employee gets paid 26 times. define the following; payAmount, payPeriods and annualPay.

>> No.3678248

>>3678242
% = $

>> No.3678252

>>3678242
Not sure if I get the question right but isn't it just simple math?

>> No.3678263

>>3678242
Oh fuck you. I was expecting something like "I have this D* search problem with a highly dynamic set of obstacles, help me find an implementation that would yield paths the fastest", not this Prog 101 bullshit.

>> No.3678264

>>3678242
Are you fucking serious? This is simple arithmatic; if you can't do this then get out of comp sci while you still can.

>> No.3678272

How about paying attention in class and actually reading your textbook?

>> No.3678280

>>3678252
basically yes. i'm having problems with the actual coding..
>>3678242
Only been in this class 2 times. Semester just stared. I guess it's not understandable?

>> No.3678310
File: 11 KB, 288x121, screenshot.png [View same] [iqdb] [saucenao] [google]
[ERROR]

Here you go OP.

>> No.3678321
File: 73 KB, 872x400, php-java-haskell.1202313464429.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

>>3678280
If you aren't a troll, there is a very good chance you are secretly retarded or have AADD.

>> No.3678319

>>3678310
He said define, not declare, you dummy.

>> No.3678318

>>3678310
this is not correct...

>> No.3678324
File: 38 KB, 499x378, 1296380744022.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

Troll or retard.

if(op == troll)
go.fuckself
else if(op == nub)
enroll(I.T.)

>> No.3678327

Is it just me or are Comp Sci students not as intelligent as they are made out to be?

>> No.3678332

>>3678327
You have to start at zero

>> No.3678348

>>3678327
The fact that they took comp sci already supports your observation.

>> No.3678350

>>3678318

yes it is, he have defined the following; payAmount, payPeriods and annualPay.

>> No.3678354
File: 24 KB, 484x180, screenshot.png [View same] [iqdb] [saucenao] [google]
[ERROR]

>> No.3678358

>>3678354
her*

>> No.3678362

>>3678358
Well that explains it.

>> No.3678382

Idk wtf do, but when i debug the console just pops up and disappears in less then a second.

>> No.3678398

int payAmount = 1700;
int payPeriods = 26;
int annualPay = payAmount * payPeriods

>> No.3678399
File: 25 KB, 488x192, screenshot.png [View same] [iqdb] [saucenao] [google]
[ERROR]

>>3678382
If your teacher says to use system("PAUSE") punch him/her in the dick.

>> No.3678409

>>3678399
you seem upset

>> No.3678427

>>3678409
system("PAUSE") is for faggots

cin.get() master race

>> No.3678429

>>3678399
Real pros #include <windows.h> and use sleep(9000000001);

>> No.3678431

>>3678409
Both C++ professors I've had were fucking idiots.
>Mac vs "PC" rants praising Macs
>telling students to install VS and DevC++
>teaching system calls like PAUSE and CLS
>teaching horrible programming habits
>other idiotic crap

>> No.3678451

Try:
System.Console.ReadLine();

compile with /CLR

>> No.3678462

We did OPs homework for her.
Pics?

>> No.3678465

>>3678431

If your instructor is having you install Dev C++ instead of Visual Studios from a MSDN account, I would have to question your entire college's approach to education for using free tools rather than industry standards.

>> No.3678476

>>3678465
>industry standard
Fuck you and fuck that word.

>> No.3678487

>>3678427
you still seem upset

>> No.3678499

i wont help with yuor cp you fucking freak

>> No.3678500

>>3678399
whats wrong with pause?

>> No.3678505

>>3678476
>Unemployed Linux user detected.
The point of going to university is so that we can get good paying jobs upon completion of the course. If the college uses tools that are different that what is standard in the job field, your job placement choices suffer.

No legitimate fortune 500 company that needs someone to do code would say "screw that M$ stuff, we only use free software here!" They expect you to know Visual Studio, and they aren't willing to train. That's what you should have learned in college.

>> No.3678507

>>3678476
So, you hate C++ then?

>> No.3678511

>>3678500
It's Windows only.
It's very wasteful.

Google it and you'll find lots of articles explaining why it's bad.

>> No.3678520

>>3678505
Instead of teaching M$ specific crap, why not teach ANSI standard compliant code? So that way it isn't OS dependent.

>> No.3678537

>>3678465
> Visual Studio an industry standard
Which standard would that be? ISO-9294? ANSI-IEEE 444? Or RFC-665-OutOfMyAss?

>> No.3678544

>>3678520

Do large enough OS independent programs even exist?
(not a sarcasm, I'm genuinely interested. I just very often hear things like "we're currently trying to port this program from Win/Linux to Linux/Win")

>> No.3678546

>>3678399
>using \n instead of endl

>> No.3678547

>>3678511

I'm fairly new to C++, and I typically use:

int a;
cin>>a;
return 0;

as a way to keep the screen from flashing the answer. Is that preferable, or is there another way that is preferable?

>> No.3678551

>>3678544
Yes, lots.
Photoshop, Cubase, Pro Tools, FL Studio, lots...
There's almost always a FOSS alternative though.

>> No.3678554

>>3678537
I think, it's called "standart de facto".
Unfortunately, these things not always obey committees.

>> No.3678555

>>3678520
Give me an open source language with as many plug-ins, documentation and portability as Visual Studios has and I would agree with you. It's just that making sure that it works on Macs and Linux boxes isn't as important to a company as a safe and secure setup for the computers that they actually use. The evolved debugger actually returns very clear information about what is wrong with the code rather than cryptic messages that aren't found anywhere in the documentation or boards for the site where you downloaded Dev C++. I DID have an instructor that wanted us to use that crap. I ended up doing my code in Visual Studio then copy-pasting it into Dev C++ just to make sure it still worked.

>> No.3678557

>>3678546
Like it really matters.

>> No.3678566
File: 22 KB, 426x304, 1287553892586.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

>>3678547
>cin>>a;
>not using formatted input

why?

>> No.3678568

>>3678555
>open source language

>> No.3678572

>>3678557
>implying endl isn't ~3% faster

>> No.3678573

>>3678555
> Give me an open source language with as many plug-ins, documentation and portability as Visual Studios
Do you even know the difference between a language and an IDE?

>> No.3678574

>>3678572
I want the user to wait in suspense.
It makes the program more exciting.

>> No.3678584

>>3678566

Because I don't care if it crashes at the end and [spoiler]I don't know how to use formatted inputs[/lolspoiler]

>> No.3678592

>>3678584
Or spoilers for that matter.

>> No.3678591

>>3678551
>Photoshop
Do you mean Win+MacOS? Because the only mentions of Photoshop for Linux I found was a 3 year old article about Google commiting hell lot of a patches to Wine so it could run Photoshop.

>> No.3678596
File: 189 KB, 677x698, panty-stocking-pick-locks.1314227231013.png [View same] [iqdb] [saucenao] [google]
[ERROR]

>>3678544
Mozilla Firefox

>> No.3678599

>>3678591
Yeah, I wasn't really thinking too hard on that list.
PS and PT are Win/Mac.

>> No.3678608

>>3678544
>independent
Ah shit. Sorry, tired.
But to correctly answer your question, yes there are quite a few.
Most Linux software also have builds for Win/Mac.

>> No.3678611

>>3678592
>/sci/
>spoilers

I see you are new here.

>> No.3678612

>>3678596
OK, that I like.
Thank you.

>> No.3678630

>>3678224
implying those losers can code

>> No.3678631

Anyway to use this video as Windows 8 build 7989 or Windows 7 boot screen?

http://www.youtube.com/watch?v=Kg0VOfD7Iek

>> No.3678645

>>3678208
hahha this thread takes me back.

feels good to be able to actually code.

Hey OP don't worry: your ignorance is amusing to any of us who can write code, but it's tough starting out.

>> No.3678693

This thread made me laugh.

>> No.3678737
File: 39 KB, 250x250, 1309388886248.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

>2011
>not programming with java master race

ishygddt

>> No.3678789

>>3678348
what class should one take?

mathematics/logic courses?

>> No.3678801

>>3678737
Yeah, I love to turn on a memory hungry VM every time I want to use "Hello world" class program.
Seriously, maybe Java is fine, if you want to compute relatively small amount of data and you need/want to write a program fast, but if I have to analyse shitload of information, I'll use C or C++. It's maybe less friendly, but at least it's faster, if you use it properly.

>> No.3678802

>>3678737
> 8 minutes between that post and the previous one
Of course. It was how long it took for the VM to start.

>> No.3678814

>>3678737
>Java
>can barely run Minecraft on the most recent computer hardware

Yeah, fuck Java.

>> No.3678869

Fuck OP, I have a real C++ question.

How can I make my programs crash when I double delete a pointer?

>> No.3678880

>>3678869
Wait, what? You want your program to crash?

>> No.3678896

>>3678880
More specifically, when I double delete a pointer. It's undefined behavior either way, and having it silently do STRANGE MYSTERIOUS THINGS makes it hard to fucking debug.

>> No.3678903

>>3678880
He's probably coding for Mac OS X.
But it's simple just add:
do{
spinning_rainbow_orb = 1;
}while(spinning_rainbow_orb==1);

>> No.3678924

>>3678903
I suppose an infinite loop is better than nothing, but if I knew where my undefined behavior was in order to place it I wouldn't need it in the first place.

>> No.3678931

>>3678903
Couldn't you just

while(spinning_rainbow_orb=1);

>> No.3678936

>>3678931
If he's coding for OS X he needs to make the code as retarded and inefficient as possible.

>> No.3678945

>>3678936
The only real difference between what you two wrote is that the compiler would produce a warning for his code. To fix that, btw: while ((spinning_rainbow_orb=1));

>> No.3678951

>>3678936
Ah yes, null must be nil, true is yes and false is no

Never change apple.

>> No.3678963

>>3678945
>requiring additional parentheses

I didn't bother to try it, but why would that generate an error?

>> No.3678974

>>3678963
Not an error, a warning. Using an assignment as a truth value is usually a typo'd == comparison, to make the compiler understand what you really mean, cast the assignment bool. On g++, -Wparentheses will catch it, though you really should get into the habit of using -Wall

>> No.3678990
File: 124 KB, 200x468, bar-loli.png [View same] [iqdb] [saucenao] [google]
[ERROR]

>>3678945
Actually, they are different in that they loop infinitly for a different reason. The first loops because spinning_rainbow_orb==1. The second loops because (signed int) 1 was successfully assigned to spinning_rainbow_orb. In cpp, if spinning_rainbow_orb happened to be an instance of a class with an overloaded assignment and/or equivalence operator, this difference could lead to unexpected behavior that could be difficult to recognize. while(true);

>> No.3679008

>>3678990
I would say something like given the context of the question blah blah blah, but given that it didn't come anywhere near close to answering the question that's obviously being too charitable.

>> No.3679028
File: 19 KB, 400x400, sakura-goatse.1209310167947.jpg [View same] [iqdb] [saucenao] [google]
[ERROR]

>>3679008
The post I quoted did not ask a question. It made two statements. The first was incorrect, and my post described why.

>> No.3679039

>>3679028
>I'm incapable of following a thread of conversation
Good to know.