Tuesday, 25 September 2012

Emelt fakt C++

Logikai utasítások

 if (i%5!=0)   cout << i << endl;

 if (i%5==0)   coutinue;

 ==
>
<
<=
>=
!=

and    &&
or        ||



 switch (muv) {
    case '+': cout << a+b << endl; break;
    case '-': cout << a-b << endl; break;
    case '*': cout << a*b << endl; break;
    case '/': cout << a/b << endl; break;
    default: cout << "Ilyen muvelet nincsen" << endl;
    }


Random number

#include <time.h>
 
  /* initialize random seed: */
  srand ( time(NULL) );

  /* generate secret number: */
  iSecret = rand() % 10 + 1; 
 
 
 
 
 
http://www.doc.ic.ac.uk/~wjk/C++Intro/CourseStructure.html#S1 

No comments:

Post a Comment