system("PAUSE") and getline function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • saiavinashiitr
    New Member
    • Mar 2014
    • 16

    system("PAUSE") and getline function

    i am confused when to use system("PAUSE") and when nnot to???
    what is a getline function?
    when i execute the program with int main() (or) int main(void) there is no error coming...can u explain y it is happening so??
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    You should never use system("PAUSE") ; it is an abomination. If you are writing a command line program then run it from the command line.

    std::getline or or istream::getlin e read a whole line of text including spaces into a std::string or char array up to the newline character (or a provided separator). Most other stream operators read up to the next space.

    In there is no difference between int main() and int main(void), they both define main as accepting no parameters and returning an int and are both valid forms of main. You might be getting confused with void main() which is not a valid form of main because main always returns int.

    Comment

    Working...