Differences in teaching a problem?

This is a discussion on Differences in teaching a problem? within the C++ Programming forums, part of the General Programming Boards category; ok, first off i'd like to explain myself... im new here, i stumbled upon this site searching at google.com looking ...

  1. #1
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160

    Question Differences in teaching a problem?

    ok, first off i'd like to explain myself...

    im new here, i stumbled upon this site searching at google.com looking for a way to clear screen. NO! don't jump to conclusions i read the FAQ and i see how...thats not my question...im in a 1st year CPP programming class in highschool (yes highschool sad aint it)...which comes to my question...

    in this sites administrator's tutorial, he uses "\n" instead of the way i've always been tought "<<endl;"... so, is there any restrictions to these? no flames please im new ...

    also, i noticed he (could be she sorry in advance) uses

    <stdio.h> instead of what i use <iostream.h>... is there any problem there? don't get angry with me, i repeat, im new ..

    does <conio.h> come with Visual Studio? (haven't gotten it yet, we use it at school and soon to be at home)

    last and least important... when he writes "int main(void)" does he really mean us to put the void in there, i never have actually put anything in the "()" before lol...

    thanks in advance
    Paro

    P.S. your site rocks admin (dont know names sorry)...seriously it rocks, i found out how to clear screen in console mode(when ive been asking my teacher for weeks) in less than a minute

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    don't get so afraid of us jumping to conclusions. we were newbies once.
    1) the \n and endl are both acceptable, i think endl = '\n'
    2) stdio.h is a lower-level way to print and ask for input. iostream does the same thing except using objects. stdio is availiable in C and c++. iostream is only in c++. i think there's another post if you want more information.
    3)<conio.h> i believe it comes with any dos/windows compiler. it can be used only with dos/windows.
    4)int main() is the same as int main(void). void just makes it clear. use whichever you like.
    and if it makes you feel any better, i still don't know how to clear the screen.

  3. #3
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160

    Well

    just because i read how doesn't mean its going to work, tomorrow we have a test on the input and output of <fstream.h> so i won't be able to test the clear screen...

    but if i get it to work i will amaze all of the students and i will be the most popular kid in the class ( chuckles)

    im pretty much the brains of the class, except one kid whos better at teaching...but I got the A and he got a C mwahaha... ok now im telling you my lifestyle...

    ill stick to questions:

    1) is there any possible way to put depth into a console application program? (the one that looks like a dos window)

    2) is there any way to slow down whats being outputted, one way ive done that is to do this:

    for (int x = 1; x<=1000000; ++x)
    (some unimportant variable change here)

    and that usually pauses it for 2 or 3 seconds...any other way to do it?

    3) do you prefer pepsi or coke? ()

    Paro

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >is there any possible way to put depth into a console application program?
    What exactly do you mean?

    >is there any way to slow down whats being outputted
    The loop like you posted, or a call to a sleep function. Check your compiler's help files to see how to implement it on your machine.

    >in this sites administrator's tutorial, he uses "\n" instead of the way i've always been tought
    It doesn't really matter since they both behave in a similar manner.

    ><stdio.h> instead of what i use <iostream.h>...
    stdio.h contains C based functions such as printf and scanf, iostream is home to cout and cin.

    >does <conio.h> come with Visual Studio?
    It does, but you would do well to not use it since conio and anything included in it are nonstandard.

    >when he writes "int main(void)" does he really mean us to put the void in there
    Yes, main has two and only two forms, int main ( void ) and int main ( int argc, char *argv[] ). Anything else is undefined.

    >do you prefer pepsi or coke?
    Root beer

    -Prelude
    My best code is written with the delete key.

  5. #5
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    >in this sites administrator's tutorial, he uses "\n" instead of the way i've always been tought
    endl and \n are similar but not exactly the same. endl causes a stream flush whereas \n does not.
    when he writes "int main(void)" does he really mean us to put the void in there
    In C yes. In c++ it really doesn't matter.This is because of the fact that in c++ a function declared as int main() is exactly the same as int main(void).
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  6. #6
    SeŮor Member
    Join Date
    Jan 2002
    Posts
    561
    2) is there any way to slow down whats being outputted
    Sure. I think it's System(milliseconds); . Yes, System is supposed to be in caps. I'm not sure what header it's in, but I think it's stdlib or stdio. Example: System(3000); pauses for 3 seconds. I think this is how you do it, but I have only used it once and that was a while ago.

  7. #7
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    As you are using Windows, it's Sleep(3000), not System.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  8. #8
    Unregistered
    Guest
    Damn! At least I was close though.

  9. #9
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160

    Thanks

    thanks a lot guys for the input, so now i understand that the admin was mainly using C code and not C++...i think i mentioned im c++ if you guys werent to sure... ah yes first paragraph... anyways...

    the sleep() command... does that require a certain header file? i will go check the tutorial on this site briefly to check and if its there and tells me ill edit this out

    thanks again cya
    Paro

  10. #10
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    on msvc you will find Sleep() (notice the capital S and remember c++ is case sensitive) in <windows.h>
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  11. #11
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160

    Talking :D

    thanks so much i was just about to leave for school and i decided to check to a reply

    im going to make the coolest programs ever

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21