hey there ,

Im taking C++ courses in my collage (so ım a newbie) and they are teaching programing language a bit different from the examples in this forum.

#include <stdio.h>


int main (void)
{
    int x;
    int y;
    int z;
    int min;
    printf("enter 3 numbers : ");
    scanf("%d %d %d", &x,&y,&z);
    
    min=x;
    if (y<x && y<z)
       y=min;
    if (z<x && z<y)
       z=min;

    printf("min is : ", min);
    return(0);
}

well this works too, but ı can not understand most of the programs in this forum

is there any place to learn how to write that " cout << ".... ; " thing or something like this :S
ty for helping this newcommer:)


/* sorry for my bad english ı hope u could understand what ı meant */

That is C code, not C++. Are you sure you are in a c++ class?

for a fstream tutorial click here.

cout is quite easy to learn. First you have to include <iostream> header file -- it does not have a .h extension. Then declare the std namespace.

#include <iostream>
using std::cout;

int main()
{
    cout << "Hello World\n";
}

If you want to use cout and cin you'll have to include <iostream> and use namespace std.
A sample program is something like this:

#include <iostream>

int main() {
  int x, y, z, min;     // Don't forget you can declare multiple variables of the same type on the same line

  std::cout<<"Enter 3 numbers: ";
  std::cin>> x >> y >> z;         // When entering the three numbers you have to leave spaces between them here

  min = x;
  if (y<x && y<z)
    y=min;

 if (z<x && z<y)
    z=min;

  std::cout<<"min is : " << min << std::endl;            // This prints text with the first insertion operator '<<', and a variable with the second
  // I added an endline for the beauty of it

  system("pause");   // Pauses the application
  return 0;
}

It's really not that hard, a good site would be: http://www.java2s.com/Tutorial/Cpp/0100__Development/0040__cout.htm
By the way, why give void as an argument to main?

Hope this helps, if you have any questions just post them ^^

EDIT: bah, Ancient Dragon beat me to it

ty for your replies.

That is C code, not C++. Are you sure you are in a c++ class?

well, i am taking introduction to programing class and they are telling us that " we are teaching you c++" but im not so sure about this now :)

By the way, why give void as an argument to main?

i have no clue about this they just tought us to do that this way and when i ask assistants about it, they just dont explain us clearly .

ty again

This question has already been answered. Start a new discussion instead.