cchalogamer Posted February 10, 2005 Posted February 10, 2005 IF you would liek and have AIM or even better TeamSpeak ill be glad to go over exactly what's happening. It's not really that complicated once you understand. the only thign is im assuming you havent had any real assignments yet have you? Well until this one. Share this post Link to post Share on other sites More sharing options...
Ste Posted February 11, 2005 Posted February 11, 2005 AIM will do, I gotta download it but I do have account. Its FastGamer04 this first assignment we had to type it for ourselves, yes.. Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted February 11, 2005 Posted February 11, 2005 *sigh* Here it is in C++, convert it to Java: #include <iostream> #include <stdlib.h> // For system("pause") using namespace std; int nResult; int nInput; int funcConvert(nFuncResult) // This function does the conversion formula { nResult = (9/5 * nInput + 32); cout << "\n\nThe temp is: " << nResult << "*F.\n\n"; //Display the result return(nResult); } int main() { cout << "Enter the temperature in Fahrenheit to be converted\nto Celsius:\n > "; cin >> nInput; funcConvert(nInput); system("pause"); return 0; } Share this post Link to post Share on other sites More sharing options...
Ste Posted February 11, 2005 Posted February 11, 2005 Ya thanks anyways, like I understand that. lol Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted February 11, 2005 Posted February 11, 2005 Would you like me to comment it all out for you? #include <iostream> /* Like java.import.io or whatever, it has standard input/output stuff */ #include <stdlib.h> // For system("pause") using namespace std; /* We need this to tell it what functions we'll use and stuff */ int nResult; /* For the result */ int nInput; /* For the input */ int funcConvert(nFuncResult) // This function does the conversion formula { /* This starts the conversion function */ nResult = (9/5 * nInput + 32); /* This multiplies and divides and that edjewkated stuff */ cout << "\n\nThe temp is: " << nResult << "*F.\n\n"; //Display the result return(nResult); /* This returns the result for no danged reason except for that I need a return */ } /* This ends the conversion function */ int main() /* This is your main function where the main, non-functionated code goes */ { /* This starts the main function */ cout << "Enter the temperature in Fahrenheit to be converted\nto Celsius:\n > "; cin >> nInput; /* This asks for user for the input */ funcConvert(nInput); /* This calls the function */ system("pause"); /* This says "Press Any Key To Continue..." and then you press a key, and it exits! */ return(0); /* returns the result that we need, saying that the program exited normally */ } /* This terminates the main function */ Share this post Link to post Share on other sites More sharing options...
Ste Posted February 11, 2005 Posted February 11, 2005 no no, please i don't want it, id rather talk to someone on AIM and have it explained so i could do it by my self when i won't have the help. Share this post Link to post Share on other sites More sharing options...
cchalogamer Posted February 11, 2005 Posted February 11, 2005 (edited) Well since you dont seem to be on AIM at the moment and im sleepy now im oing to bed. feel free to IM me eitehr around 7:00-730 in the morning or if i happen to be on AIM at school during 2nd period 9:45-11:15 or so. crap forgot times are EST. Edited February 11, 2005 by cchalogamer Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted February 11, 2005 Posted February 11, 2005 And you didn't talk to your teacher about this... why? EDIT: I don't see what's so hard to understand about it. Switch the C++ syntax with Java syntax, and rewrite it yourself, and you should understand it. The basic part of it is pretty much: Ask for input. Call a function with the input as an argument. Have that function execute a formula. Have that function display the results. End the function. Tell the user to press a key. Exit. Share this post Link to post Share on other sites More sharing options...
Ste Posted February 11, 2005 Posted February 11, 2005 (edited) Its my first class of prgramming, and its only 3rd week up till now, we were only asked to copy some code down and learn what it did. thats why. Uh nevermind I figured it out I had to change double result into int sum and i tpyed some inputs incorrectly i typed JOptionPane.show.InputDialog. when its susposed to be. JOptionPane.showInputDialog( But thanks anyways everyone, ur rught it was alot easier then I thought it would be. Edited February 11, 2005 by Ste Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted February 12, 2005 Posted February 12, 2005 Lol, it's Java. Wait untill you learn a REAL language, like Assembley! Share this post Link to post Share on other sites More sharing options...
Ste Posted February 13, 2005 Posted February 13, 2005 Don't scare the newbies. hrmm k? lol Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted February 13, 2005 Posted February 13, 2005 Wanna know what Hello World looks like in C++? #include <iostream> #include <stdlib.h> using namespace std; int main() { cout << "WORLD DOMINTATIOOOON!\n\n"; system("pause"); return(0); } In Assembler: title Hello World (hello.asm) .model small .stack 100h .data message db "Hello World",0dh,0ah,0 .code main proc mov ax,@data mov ds,ax mov ah,9 mov dx,offset message int 21h mov ax,4C00h int 21h main endp end main Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now