BASIC

Author Topic: C++ oder  (Read 9334 times)

Offline trucidare

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1377
  • Bachelor of Fail
    • View Profile
C++ oder
« Reply #15 on: 2007-Jul-15 »
Code: GLBasic [Select]
if(var==true)
{
mach was
};
und

Code: GLBasic [Select]
switch(var)
{
case wert:
  tu was;
break;
}
MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

Dragoon-Fighter

  • Guest
C++ oder
« Reply #16 on: 2007-Jul-15 »
Aso, ich habs mal als bei spiel da stat tuh was und so cout geschrieben...also eine Funktion, is ok....

Dragoon-Fighter

  • Guest
C++ oder
« Reply #17 on: 2007-Jul-15 »
no match for 'operator==' in 'var ==  true'

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
C++ oder
« Reply #18 on: 2007-Jul-16 »
OK. ganz von Vorne nochmal:
in GLBasic:
Code: GLBasic [Select]
IF var = TRUE
   machwas()
ELSE
   machwasanderes()
ENDIF
in C++ (mit INLINE)
Code: GLBasic [Select]
INLINE
if (var == true)
{
   machwas();
}
else
{
   machwasanderes();
}
ENDINLINE
oberes wird empfohlen.

Dragoon-Fighter

  • Guest
C++ oder
« Reply #19 on: 2007-Jul-16 »
Habs gefunden, wenn es jemanden interessiert, hier:

#include
#include
#include
#include
#include
//...
const std::size_t count = 2;
std::vector< std::string > initialize()
{
    std::srand(time(NULL));
    std::vector< std::string > v(count);
    v[0] = "хакер";
    v[1] = "нуб";
    return v;
}
const std::string &generator()
{
    static std::vector< std::string > v = initialize();
    std::size_t index = rand() % count;
    return v[index];
}
// ...
std::cout << "Вася " << generator() << std::endl;

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10661
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
C++ oder
« Reply #20 on: 2007-Jul-16 »
in GLBasic:
Code: GLBasic [Select]
PRINT "BakR " + generator$(), 0,0
SHOWSCREEN
MOUSEWAIT


FUNCTION generator$:
LOCAL data$[], index
   // Make data array (2 values here)
   DIMDATA data$[], "xakep", "Hy6"

   // Get a random one
   index = RND( BOUNDS(data$[], 0) -1 )

   // return it
   RETURN data$[index]
ENDFUNCTION

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4971
  • O Rly?
    • View Profile
C++ oder
« Reply #21 on: 2007-Jul-16 »
?? versteh die thematik nicht, was hast das mit GLBasic zu tun?
Geh doch lieber ins C++ Forum !
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2666Mhz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Dragoon-Fighter

  • Guest
C++ oder
« Reply #22 on: 2007-Jul-16 »
^^ Ja, das hab ich auch gerade gemerkt :D aber trotzdem danke Leute!