Added: 2 years ago
From: thenewboston
Views: 160,230
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:
see all

All Comments (383)

Sign In or Sign Up now to post a comment!
  • Why is it that it closes as soon as I type in the second number, even though I have the getchar(); at the end? Help will be appreciated. Thanks

  • @Mynameisjami92 try using system("PAUSE");

  • can you work at my university? Can you be my prof? Thanks, that's be great

  • Bucky, you should do an OS development tutorial

    That'd be so sick

  • i need help! is someone here knows how to do a derivative and integration command in C?

  • i just started using c++ and my bro got me started on this thanks to this guy i am starting to learn how to program and i suppose it will be a long track to making games...

  • haha i gues that's a way to do it just did this in printf "the sum of your numbers is: %d\n", (num1+num2)

  • getch(); doesn't work with me it says undefined reference to getch

  • @Shockszzbyyous pund include conio.h for getch() to work

  • @bondservant4Him that kinda helps, but I don't need getch() in a linux terminal when I write a line just ends it it with the root thingy just showing the results above it still :)

  • @Shockszzbyyous yeh if your using linux you dont need anything at the end of your program because you are using the terminal which stays open even after the program ends

  • @bondservant4Him thanks.

  • we should use the program what to study C program??? help....

  • What does conio mean ?

  • @garciagod console input output

  • when i hit enter to enter the second value the program encounters a problem

  • 2686784 ....this is my result whatever I put in ...like 5+5= 2686784 what is wrong ?

  • @85Damix take a look at your printf ... u shouldnt put "&" in your variable..

  • Hi I just want to start out by saying I am personally just learning programming altogether let alone just this language and you are doing a great job explaining little things that some other tutorials are not explaining. If you could explain or message me and let me know why you have the spaces you do between certain texts I would appreciate it. for example the first 5 or so spaces between each line, or on this particular one why you put an empty line between the scanf and printf functions.

  • @ryan005869 basically white space doesnt have much meaning in coding other than makeing your code look pretty

  • crash**

  • guys, me and many other ppl having that problem that the program cras once we entred the 1st number, plz some 1 help :(

  • @vengeanceage you are forgetting the '&' before the variable in the SCANF

  • @bondservant4Him nope, i didnt forget to put them, the code i put in the compiler is just like the 1 in the video, i dont know wats wrong :(

  • @vengeanceage private message me the exact code you have ill take a look

  • @bondservant4Him Thats ok i manged to get it work at last "retyped the whole code" still didnt know wat was wrong, but thnx alot for help.

  • Excellent job! And thanks in bunch for helping us.

  • u are awsome pal :)) thanks.

  • Why did you use -conio.h-?

  • @latvian83 it allows him to use the getch() function

  • @bondservant4Him Thanks for your reply!

  • Thanks! I tried C++ but I always got errors in my compiler. But C works great! and it feels more comfortable.

  • Thank you very much for this.

  • "lots of thanks"... :)

  • This only gives me %d for a result.

  • printf("Tons of Thanks");

  • which program are you using dev c++ or visual c++ 2008 express

  • @newundertaker007 Dev C++.

  • My program is nt showing the calculated result and window closes when i press ENTER for the calculated result

  • @nuclear181 yeah dude me too. It shows the answer for a split second then closes right?

  • Comment removed

  • The man who came up with C died recently and unlike Steve Jobs, he's not remembered by the mainstream.

    So use a few seconds of your life now, even if you aren't familiar with the language yet, to be thankful to Dennis Ritchie

    printf("Thank you Dennis. \n");

  • @SlipAllCityToy I agree, I have been doing my best to spread this, but sadly have not been able to get it through to some people that he was just as, if not more important to technology as we know it then Steve..

  • @SlipAllCityToy It sucks that I was just recently going back to c programming, I swear I just barely recognized the name of Dennis Ritchie and he's dead... =( Damn.. R.I.P Dennis

  • @SlipAllCityToy It didn't run ;_;

  • good humor applying for c jobs haha

  • it works fine but once i put my number in, then press Enter, then it closes and don't stay open for me to see the caculation

  • @levi052594 t

    just type in system ("PAUSE")

  • I'm having a problem running this program...it compiles perfectly but while running after entering the value of num2 a window pops up with the message that the program has stopped working and has to close....i am using windows vista..can anyone help pls!

  • @shreyash015 make sure you have the '&' before num

  • @shreyash015 you can use visual c++ 2008 express edition and register it for free using a windows live id. you can watch a video demo on my channel which explains how to program in c in visual c++ and how to use the debugger

  • Whenever i try to compile and run it keeps getting that error on my printf line! I put it as printf("Enter your number:"); am i doing it wrong?

  • C is awesome. Python makes it a little easier to focus on the concepts though. C reminds you if you make even one little mistake, it is going to not work or do odd things. For sure going to focus more on this soon. Thanks thenewboston!

  • what does #include conio.h do

  • @paulceltics allows you to use the function getch();

  • What software can I use for C programming?

  • when i enter my first number, i press "ENTER", and before i could enter the second number, it pops out a window, everything stops working, it says windows is searching for a solution to this problem, how come?

  • @shuwukong your scanf needs an '&' in it

  • @bondservant4Him

    thank you

  • int Me;

    int AngelinaJolie;

    int sex;

    printf("Hello, World!\n\nEnter a number to calculate.\n\n");

    scanf("%d", &Me);

    scanf("%d", &AngelinaJolie);

    sex = Me + AngelinaJolie;

    printf("The answer is %d", sex);

  • do you also have a tutorial for variable types?

  • I really love that your putting up these great tutorials! But I think it would be more helpful for viewers to understand why you had those #include statements at the top, and the function getch();. many new programmers won't know what those are for, and what your print lines are referring to (command line arguments). Being slightly more detailed would help enormously. Thanks for the great vids!

    Mike

  • Never mind guys! I forgot the & in front of num1 and num2. Man, you really have to pay attention to detail in programming! But I am very excited that thenewboston has posted this tutorial.

  • Could someone help me out with a problem I am getting?

    Okay, so I compile and run the program and I get the Enter your number:_ in the DOS popup. I am able to enter the first number, but when I press Enter to go to the next line for the other number it gives me this message:

    Calculator.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

    Any suggestions?

    Thanks in advance!

  • lol, baboon

  • @100silverpizza watch Tutorial 1 first

  • why is my that it always shows my sum 65 ?? please help someone please!!!!!!!

  • this isn't working for me, iv'e typed the code correctly but every time the sum is equal to 2293581. please can somebody help. i am using the same compiler and have saved it as c source code

  • @AShiftyDealer you maybe miss some sign or letter

  • why is that you didn't typed the "return 0;" ???

  • whats the use of #include conio.h ??????

  • @PH5221 Yes, I took this from the top comment in case you couldnt see it

  • the new boston is the ultimate king of you tube

  • " the new Boston " is the ultimate king of youtube

  • printf("Your tutorials rock");

  • THANK YOU ALOT! THANKS TO YOU I MADE MY FIRST CALCULATOR FROM MY HEAD! KEEP UP GREAT WORK, LOVE YOUR TUTS!!!!!!!

  • don't worry, I took off the conio.h and it worked perfectly :P

  • aha i know these things are old, but i need help D: I am using Ubuntu and it tells me that conio.h isn't right...

    "No such file or directory"

    what do?

  • getch()?

    i am using scanf

  • @a1337turtle

    Lolz sorry, buddy, but I prefer to produce it on a device where you can actually make a fortune if it makes it to the top.

  • what if you actually want to type \n? :o

  • @cookiesRgood26 Print, not type lol

  • @cookiesRgood26 i think you have to put a double % though im not really sure lol

  • Great

    

  • Oh nice tutorial!! I just want to develope this iPhone app =.=

  • @Rorintosh You might be better off developing apps for the android, buddy.

  • when i run it it says this is wrong:

    sum = num1 + num2; why?

  • @ComputerHelp007 did you declare num1 and num2 before/?

  • if you wanted to make a calculator, I am sure it would be easier to do so in Python or Perl? :)

  • @TheGeekSquadron Kinda. You don't get the hardcore control over floating point that you might in C which can be a big disadvantage for numerical computing especially where performance matters. Python has some limited OS-specific control. Not sure about Perl. Those ultra-high level languages pretty much ARE calculators.

  • @Ormaaj Thanks for the reply, I see Lisp code as the new way forward instead of C though :)

  • when ever i run the program it opens get's closed immediately please help me

    

  • @ASHISTER1 put getchar(); at the end of your code

  • @bondservant4Him thanks

    

  • Why does it keep saying the answer is 27? Help please

  • @chewbacca2100 pm me your code, it could be with your sum could be the problem

  • i love you .... you so nice ! hehe

  • for some reason the compile box just flashes in the middle of my screen as far as i can see im doing everything rite help please

  • I got to tell you, I really struggled with this, but I'm glad I stuck with it, and now I can recite this full code in my head =).

    Thanks dude.

  • Bucky rules! :D

  • thanks a lot! :))

  • thyanks, very helpfull

  • I will say only "Thanks so much!"

  • can someone tell me why getch() wont work

  • @creese54 dont know as i havent seen your code or compiler. try using getchar() like that with a semi colon of course :P

  • @creese54 are you putting ; at the end of it??

  • does not work for me :(

  • lol java is kinda a copy of these languages or the other way around

  • im getting a linker error undefined reference to WinMain@16

    ID returned 1 exit status

    how can I fix that?

  • when you enter the number, what button do you press to calculate

  • if getch doesnt work try getchar();

    im running linux and have code::blocks with gnu gcc compiler

    getchar works for me.

  • After entering to numbers... when I'm supposed to get the sum... it closes. why?

    Help please?

  • @rx3gundam send me ur code in a pm

  • @rx3gundam

    Yeh i get the same problem

  • @Taffy11000

    lol... After a few messing around... I got it working.

    Make sure you have 2 headers. (stdio.h)&(conio.h) and make sure that "getch();" is at the very bottom.

  • Comment removed

  • how come after getting the sum it auto close

    im using Dev C++

  • @iamroxisa did you remember to type getch() ?

  • @iamroxisa Did you put getch(); at the end of the code? Because getchar() doesn't work for some codes he teaches us.

  • @iamroxisa has been one month since your post, so you probably got what you wanted, anyway, C++ is diferent to C, you have to type system("pause"); in the end for c++

  • So freaking subscribing!!

  • Anyone having problems with getch() try _getch() instead

  • Mine says it cant run because it does not have a shebang line.

  • How do I use different variables to compute area in one programm? For example I need to calculate area of a circle using char, int, and float. I can only get the right output for the first variable.

  • @MzBUZZKILINGTON why would u need a char?

  • excellent work, really appreciate, using this as revision for my exam in 2 weeks

  • @Judasthe13thdisciple help :P

    

  • This is odd.... whenever I enter the first number it comes up with "This program has stopped responding" and the laoding bar pops up and it grays over....

  • @Judasthe13thdisciple send me ur code in a pm

  • @Judasthe13thdisciple

    hey..u got solution about this?

    im having same prob....

    please share with me...

  • @Judasthe13thdisciple

    hey..u got solution about this?

    im having same prob....

    please share with me...

  • Thanks! You're awesome!

  • hey, mine works but after it shows the sum it just dissapears.

  • @MrUltimatium1 type in system("pause"); at the bottom be fore you return 0 at the bottom, pm me if your stil having trouble

  • WHY DOES  IT NOT WORK :( i written everything like yours and it still did not work... plzz reply someone

  • @VortexClanGaming send me your code ill help u

  • i did it its great'

  • I accidentally hit a number and then g, and it said 73...:0

  • @CookieandBacon probably the ascii code plus that number

  • so is there no way to print an escape character such as "\" or "%" on the screen since they have to do something?

  • @NoneOfTheAbove312 no you can print them just type it in with out any variable types

  • printf(" The sum is %d" , sum) this comw up wid an error

  • @GI123GI 1)make sure that you put your ; after your statement.

    ex: printf(" The sum is %d, sum");

    2)remember correct data types:

    %d is for double

    %i is for integer

    %f is for float

    check all this.

    good luck!

  • printf(" The sum is %d" , sum)

  • when i open it it says calculator.exe has stopped working after i type the first number

    anyone help?

  • @IIXOLLIEXII check to make sure that scanf has a '&' in it

  • mine cant seem to work after i entered a second number , click enter, it closes what to do?

  • @megaLoster Same here. Windows just fecks up and get an error.

  • @AcridicHD dont forget to include the '&' in scanf, or it will crash

  • @bondservant4Him Ah, thank you very much. Didn't even see the '&' - silly me Xd

  • watch?v=a1RdzztQTjc

  • thnx brother

  • thnx bro

  • 1st thnks fr the lectures

    i have gt a problem

    i am using turbo C++

    wt i did was type the same program as above see this is it....

    but i getting some errors mentioning

    1)undefind symbol 'sum' in functional main

    2)function should return a value in function main

    3)num is declared but never used in function

  • When I have entered both numbers and then press enter, the answer flashes up and then disappears straight away. Any ideas?

  • @PH5221 put system("pause"); at the bottom of int main()

  • @bondservant4Him

    cin.get();

    works better.

  • @PH5221 this happened to me if you have getchar(); change it to getch();

    it worked for me

  • thanx man n thats nice vid....

  • Hey bucky, thanks a bunch for your C tutorials, I looked all over your site for the script that you typed after the tutorial and said we find / copy it on your site but I can't seem to find it.

  • Got a question: how to enable that tips that are visible when you hover a mous over function etc?

  • @IrishFeeney92 i did install it.. :(

  • I needed to repeat getchar(); twice becouse my windows closes just before showing me the results

  • @Kiko060606

    do you by any chance know why we had to put getchar() twice and the tutorial did not?

  • the getch part of the program is what isnt working on mine :( it keeps getting an error

  • @HighlyDangerousRAFA The new syntax is getchar();

  • @lightningstalon omg :D thank you so much!

  • Comment removed

  • What kind of maths is required to learn Programming? I mean i'm more of a english person myself

    I use to suck at maths - But i want to become a Programmer..Occupation wise and also as a Hobby.

  • @TheTestor2010 In short, yes. You do have to be reasonable in order to understand the workings behind algorithms. However the tutorial will give you a better indicator, so use them.

  • @TheTestor2010 ..Mathematics is an integral part of university programs in computer science. Usually to get a programmer job you will require a degree in computer science, so yes, you have to be good in maths. However, to be a hobbyist programmer, I know many who are not great at math.

  • @TheTestor2010

    Learn (propositional/predicate/modal­) logic, complexity theory (algorithmics, nice MIT vids here on YT about that subject), automata theory, linear algebra, vectors/matrices and integral calculus. Statistics, complex (dynamic) systems, chaos theory but even more important: set theory. Become familiar with the datastructures relevant to computing, e.g. stacks, queues, arrays, dictionaries, binary trees, heaps in how they relate to time complexity.

    good luck!

  • Dude! Thank you, programming is awesome

  • thanks man

  • I'm using return(0) as getch doesnt seem to work. Awesome post btw!

  • Seems like the getch(); part is what is preventing me from completing the function. Idk what is wrong