conio and buffer

Hi

I was searching to understand the function of conio.h. I found this on the page mentioned in "Source":

Possible solutions I think are flushing the input buffer (where is getch() or _getch() getting it's input?)

Source: http://www.cplusplus.com/forum/windows/6476/

What is the function and purpose of using conio.h? Someone told me it's outdated standard.

What is that "buffer" thing? I remember I also read the mentioning of "buffer" in reference to difference between 'endl' and '\n'.

Please help me with this stuff and please remember that I'm an outright beginner. Thanks a lot for your help and time.
You are trying to learn c++ with out schooling and/or a book for beginners? Most of the basics are explained in good documentation out there. I would start with basic tutorials, which might be in the Beginners board of this forum.

The creator of c++, Bjarne Stroustrup, teaches at a university and has written several books on programming in C++ and has quite a bit of info for learning it on his and adjoining websites.

there are other resources including the cplusplus.com which has beginning of programming.

that question is advanced topics and usually dealing with hardware control. The input buffer is where the info generated from pressing a key is put. Flushing is clearing out any data that was in it. A key press could produce more than one piece of information.

There are many types of buffers. A buffer is a data area that holds data of any form, usually transient data which changes over time. You mention mention elements of a string buffer with the endl and '\n'. which denote a new line, not the end of a buffer. When ever you use cin which loads a buffer to transfer the data to variable that is set by the user or programmer.

I don't know how much more basic I can get.

In the beginner sections of this forum might point you to a book or other information.
Thanks a lot, Azagaros. I did learn something out of it.

Could you please help me with another problem?

In mathematics a parameter is a variable which assigns values to other variables. In the equation "5x1 + 4x2 = 7" (here "1" and "2" are subscripts), "x1 = 3 - 4t" , "x2 = -2 + 5t". "t" is a parameter.

Likewise the term argument is also used in complex numbers for angle theta.

I have been told the function "int main()" is much like a mathematical function. Is it true?

What is a parameter and argument in programming?

In mathematics the function f(x) = 2x +7 has "x" as a variable.

It would be nice of you if you could shed some light on this. Thanks a lot.
Relating mathematics to computer isn't hard. First things first. Quit trying to confuse yourself with terms from all disciplines.

Given "x2 = -1 + 5t" looks like this in code:
1
2
3
4
      int x2;  // the result variable
      int t;    // the parameter variable 

      x2 = -1 + 5 * t ; // the equation. 


Given "F(x) = 2x + 7" I can interpret it a hundred different ways in computer speak. First question what kind of Variable is x;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>

// the basic idea here is your function represented in full c++ code assuming that x is integer.
// for all intense purposes I defaulted the functions Parameter to 10. 
void FunctionOfX(int x = 10)
{
      // for this example I will make x a count from one to 10.
      int Results[x];  // I expect x number different results.  this is a 0 based array.
      for(int xCounter = 1; xCounter < x+1; ++xCounter)  // the loop control for the count from 1 to X
      {
             result[xCounter-1] = 2 * xCounter + 7;   // the equation.
       }
      
       // printing the results
       for(int xCounter = 1; xCounter < x+1; ++xCounter)  // another loop control 
       {
             // the print out line.
             std::cout << "Result #" << xCounter << ": " << Results[xCounter-1] << std::endl;
       }
}

int main()
{
      // the programs main line.  The entry point to the computer for my code.
      int xValue = 0;
     std::cout  << "The math function F(x) = 2x + 7" << std::endl;
     std::cout  << "Enter a integer value for x(defualt 10): ";
     std::cin >> xValue;
     if (xValue  == 0)  // a test for zero.
     { 
           // do the default form of the function.
           FunctionOfX();
     }
     else
     {
           FunctionOfX(xValue);
     }
     
     // If I reach this point, everything is ok and  I can return 0 back to the system for a clean run.
     return 0;
}


Main is special function in C++. It is where all programs start to the computer. The C++ standard requires it to return something of an integer type, which can have special meaning to the operating system or calling program.

I would refer you to the functions tutorial in the cplusplus website for further information on functions, I can only scratch the surface for what is fully capable in C++.

Programming take some planning in the way you might approach a problem in any one given situation. Considering every solution might look 100 different ways to 100 different programmers.

Arguments and parameters are interchangeable terms depending on which programmer you speak to and how they are taught or how they view an individual function. Most functions can take arguments or parameters to act upon in the function's body.
Last edited on
Azagaros, thanks a lot for your detailed reply. I would ask some follow-on questions later after I have read it your previous reply several times. Thanks.
Topic archived. No new replies allowed.