Junior Developer Code
#include <iostream>
int main () { int a, b ,c; std::cout << "Enter 2 Numbers to Add "; cin >> a; cin >> b; c=(a+b); std::cout << "Sum is = " << c; int x; std::cin >> x; return 0; } also this, but i dont know how to make it keep going, like change days every 24 hours, but hey you can change it every morning if you like #include <iostream> int main () { enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday }; Days today; today = Wednesday; if (today == Sunday || today == Saturday) std::cout << " Woot Weekends!"; else std::cout << "Damn School. Today is" << today; int x; std::cin >> x; return 0; } Now im only 13 so please be polite and not critisize(no idea how to spell) But im working on C++ and i wanna help cuz me be bored |
I think what they were looking for are cope snippets of bug fixes for the emulator. Not your high school class tutorials :D .
|
im not in high school yet
|
Ya I didn't pay much attention to the age 13 action there. Anyhow in HS CS the above is what you do everyday / play games.
|
Keep working on it and don't give up. You'll get there. And you'll be surprised how fast you learn if you keep at it.
There are a lot of tutorial type sites on the internet. Visit them and try them out. Download the source for the emulator (and keep it up to date). It isn't a good example of "ideal" code, but its a great example of real world code that gets maintained and changed constantly. Check out changes other people post. Look at the code and try to figure it out. Be curious. Don't get discouraged if you don't get it right away. I like to describe it as like jumping into the deep end of a pool... you are in over your head. Thinking you will never make it up to the air... then, finally you take that deep breath and go "wow! I'm going to do THAT again" :-) |
i just downloaded the source for 5.6 what should i look at, i took a look at guilds and couldnt understand what it was talking about
|
Does anyone have a c++ calulator source?
|
calculator
a very simple calculator, im just typing it in here so you might have to correct some small compile errors, but the logic should be sound.
That would make a good debugging exercise for the trainees :) I tried leaving pointers out of it .. but hell thats what c runs on you have to learn them eventually. You will have to break out though its infinate Code:
|
hey
thanks for that, i couldnt get the case command to work before
|
Code:
#include <stdio.h> |
hey i tried make it the way i coud read it so far no errors but when i try to execute it doesnt do anything
#include <stdio.h> #include <iostream> int main () { float numberone; float numbertwo; char action; int x=0; // loop float result=0; while (x==0){ std::cout << "Enter 1st First Number "; cin >> numberone; std::cout << "\nEnter +,-,* or / : "; cin >> action; std::cout << "\n Enter Second Number "; cin >> numbertwo; switch (action) { case '+': result=numberone+numbertwo; break; case '-': result=numberone-numbertwo; break; case '*': result=numberone*numbertwo; break; case '/': result=numberone/numbertwo; break; default: std::cout << "invalid operator\n"; // non-valid character. x=1; } std::cout << " --------\n"; std::cout << " %f\n\n",result; // prints the result int b; std::cin >> b; return 0; } } |
hrm .. i think i remember something in the rules about not helping people learn how to code in this forum, maybe a moderator can move this thread to misc or something...
anyway. Im using vc++. i got several compile errors. this is pretty normal. Your code might be fine but vc++ is insane i think .. couple of quick things you might try though first change your include to : #include <iostream.h> and remove the std:: from the stream access commands so just put: cin >> blah; cout << "this is blabhblablabh"; again im rusty when using the iostreams so this might not be correct. also, i don't think you can use printf formatting keys with the streams. you have to piece together a fully formated string (using sprintf maybe) and pass it to cout. I might be wrong on this . ------- ok i am editing my post. I just checked out cout your statement : cout << " %f\n\n",result; // prints the result should read: cout << result << "\n\n"; // prints the result that makes it work. |
Hey same problem but this time it crashes or lags
|
All times are GMT -4. The time now is 09:21 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.