Воскресенье, 15.06.2025, 16:05
Приветствую Вас Гость
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 3 из 4
  • «
  • 1
  • 2
  • 3
  • 4
  • »
C/C++
TIKДата: Пятница, 13.07.2012, 02:32 | Сообщение # 31
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
de vor du alarumes xndirt xrges ese alarumem patasxanem ))
 
GSДата: Пятница, 13.07.2012, 03:40 | Сообщение # 32
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
tuftaaaaaaaaaaaa. rekursian e vor kprki!!!!!!!!

Добавлено (13.07.2012, 03:40)
---------------------------------------------
// srand.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <ctime>
#include <cstdlib>
#include <iostream>

void foo();

int _tmain(int argc, _TCHAR* argv[])
{
foo();

system("pause");
return 0;
}

void foo()
{
int a;
int k = 0;
std::srand( time( 0 ) );
k = std::rand() % 100 + 1;
std::cout << k << "\t";
std::cout << "Sharunakelu hamar 1: ";
std::cin >> a;
if( a == 1 )
{
foo();
}

std::cout << k << " ";
}

 
TIKДата: Пятница, 13.07.2012, 03:48 | Сообщение # 33
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
senc nayi

#include "stdafx.h"
#include <ctime>
#include <cstdlib>
#include <iostream>

void foo();

int _tmain(int argc, _TCHAR* argv[])
{
foo();

system("pause");
return 0;
}

void foo()
{
int a;
int k = 0;

std::srand( time( 0 ) );

for(;;)
{
k = std::rand() % 100 + 1;
std::cout << k << "\t";
std::cout << "Sharunakelu hamar 1: ";
std::cin >> a;
if( a != 1 ) break;

}

}
 
GSДата: Воскресенье, 15.07.2012, 23:46 | Сообщение # 34
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
ha eli :D

Добавлено (15.07.2012, 23:45)
---------------------------------------------
int kalod[ 4 ][ 13 ] = { 0 };
std::srand( time( 0 ) );
int i = 0;
for( int row = 0; row < 4; ++row )
{
for( int column = 0; column < 13; ++column )
{
kalod[ row ][ column ] = i++;
}
}

bool b = true;
std::srand( time( 0 ) );
while( b ){
int card = std::rand() % 52;
for(int row = 0; row < 4; row++ ){
for( int column = 0; column < 13; column++ )
{
if( kalod[ row ][ column ] == card )
{
mFace = column;
mSuit = row;
column = 100;
row = 100;
b = false;
}
}
}
}

Добавлено (15.07.2012, 23:46)
---------------------------------------------
int nkar = getFace();
int mast = getSuit();
std::string nkarner[ 13 ] = { "Tuz", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "Valet", "Dama", "Karol" };
std::string master[ 4 ] = { "Srti ", "Qyapi ", "Xari ", "Xachi " };

std::cout << master[ mast ] << nkarner[ nkar ]

Добавлено (15.07.2012, 23:46)
---------------------------------------------
tarber funkcianeren eli

 
TIKДата: Воскресенье, 15.07.2012, 23:50 | Сообщение # 35
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
nax
int card=std::rand()%52;

ete std::rand() vercrec 52 stacvelua 52%52=0
dra hamar gri

int card=std::rand()%52+1;
 
GSДата: Воскресенье, 15.07.2012, 23:52 | Сообщение # 36
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
bayc henc ena 0el piti vercni
 
TIKДата: Воскресенье, 15.07.2012, 23:57 | Сообщение # 37
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
bayc kalodit mej 0 chunes
 
GSДата: Воскресенье, 15.07.2012, 23:59 | Сообщение # 38
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
vonc chunem eeeee???? i = 0;
 
TIKДата: Воскресенье, 15.07.2012, 23:59 | Сообщение # 39
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
xi STL ches ogtagrcum @ndhanrapes?
 
TIKДата: Понедельник, 16.07.2012, 00:00 | Сообщение # 40
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
ha lav tesa 0 n
bayc inch ankapa es sax
 
GSДата: Понедельник, 16.07.2012, 00:02 | Сообщение # 41
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
etqan charcharvelem :D de kapavorac asa
 
TIKДата: Понедельник, 16.07.2012, 00:03 | Сообщение # 42
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
inch asem??????? voch xndirtes normal asum voche uzact
 
GSДата: Понедельник, 16.07.2012, 00:04 | Сообщение # 43
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
ha asa vonc asem??? zip anem fbov xrgem. xaxne karja txtum kgrem. kam vor mi 2 angam xaxas kjoges
 
TIKДата: Понедельник, 16.07.2012, 00:05 | Сообщение # 44
Генералиссимус
Группа: Администраторы
Сообщений: 24
Репутация: 10
Статус: Offline
sax gract ste gri hl@
class nerov banov
 
GSДата: Понедельник, 16.07.2012, 00:14 | Сообщение # 45
Рядовой
Группа: Пользователи
Сообщений: 12
Репутация: 0
Статус: Offline
// card.h

#ifndef CARD_H
#define CARD_H

class card
{
protected:
int mCardScore;
int mFace;
int mSuit;
int Ace;
public:
card();
~card(){};
void setCardScore();
int getCardScore() const;
void getCard();
int getFace() const;
int getSuit() const;
int getAce() const;
};

#endif

Добавлено (16.07.2012, 00:12)
---------------------------------------------
// card.cpp

#include "stdafx.h"
#include "card.h"
#include <iostream>
#include <cstring>
#include <ctime>
#include <cstdlib>

card::card()
{
mCardScore = 0;
mFace = 0;
mSuit = 0;
Ace = 0;
}

int card::getCardScore() const
{
return mCardScore;
}

int card::getAce() const
{
return Ace;
}

void card::getCard()
{
int kalod[ 4 ][ 13 ] = { 0 };
std::srand( time( 0 ) );
int i = 0;
for( int row = 0; row < 4; ++row )
{
for( int column = 0; column < 13; ++column )
{
kalod[ row ][ column ] = i++;
}
}

bool b = true;
std::srand( time( 0 ) );
while( b ){
int card = std::rand() % 52;
for(int row = 0; row < 4; row++ ){
for( int column = 0; column < 13; column++ )
{
if( kalod[ row ][ column ] == card )
{
mFace = column;
mSuit = row;
column = 100;
row = 100;
b = false;
}
}
}
}
}

int card::getFace() const
{
return mFace;
}

int card::getSuit() const
{
return mSuit;
}

void card::setCardScore()
{
int nkar = getFace();
int mast = getSuit();

switch ( nkar )
{
case 0:
mCardScore += 11;
Ace++;
break;
case 1:
mCardScore += 2;
break;
case 2:
mCardScore += 3;
break;
case 3:
mCardScore += 4;
break;
case 4:
mCardScore += 5;
break;
case 5:
mCardScore += 6;
break;
case 6:
mCardScore += 7;
break;
case 7:
mCardScore += 8;
break;
case 8:
mCardScore += 9;
break;
case 9:
mCardScore += 10;
break;
case 10:
mCardScore += 2;
break;
case 11:
mCardScore += 3;
break;
case 12:
mCardScore += 4;
break;
default:
std::cout << "Senc pti chlner:DDD " << std::endl;
break;
};
}

Добавлено (16.07.2012, 00:12)
---------------------------------------------
// comp.h

#ifndef COMP_H
#define COMP_H

#include "card.h"

class comp : public card
{
protected:
int mCompScore;
int compAce;
public:
comp();
~comp(){};
void compResult();
int getCompScore();
int getCompAce() const;
};

#endif

Добавлено (16.07.2012, 00:12)
---------------------------------------------
// comp.cpp

#include "stdafx.h"
#include "comp.h"
#include <iostream>
#include <string>
#include <windows.h>

comp::comp()
{
mCompScore = 0;
Ace = 0;
}

int comp::getCompScore()
{
return mCompScore;
}

int comp::getCompAce() const
{
return compAce;
}

void comp::compResult()
{
getCard();
setCardScore();
compAce += getAce();
int cardScore = getCardScore();
mCompScore = cardScore;

int nkar = getFace();
int mast = getSuit();

std::string nkarner[ 13 ] = { "Tuz", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "Valet", "Dama", "Karol" };
std::string master[ 4 ] = { "Srti ", "Qyapi ", "Xari ", "Xachi " };

std::cout << master[ mast ] << nkarner[ nkar ]
<< "\t" << "@ndhanur achokner: " << getCompScore() << std::endl;
Sleep(2000);
}

Добавлено (16.07.2012, 00:13)
---------------------------------------------
// player.h

#ifndef PLAYER_H
#define PLAYER_H

#include "card.h"
#include <string>

class player : public card
{
protected:
int mPlayerScore;
std::string mPlayerName;
int playerAce;

public:
player();
~player(){};
void setName( std::string & );
std::string getName() const;
void playerResult();
int getPlayerScore();
int getPlayerAce() const;
};

#endif

Добавлено (16.07.2012, 00:13)
---------------------------------------------
// player.cpp

#include "stdafx.h"
#include "player.h"
#include <iostream>
#include <string>
#include <windows.h>

player::player()
{
mPlayerScore = 0;
mPlayerName = "";
playerAce = 0;
}

void player::setName( std::string & name )
{
mPlayerName = name;
}

std::string player::getName() const
{
return mPlayerName;
}

int player::getPlayerScore()
{
return mPlayerScore;
}

int player::getPlayerAce() const
{
return playerAce;
}

void player::playerResult()
{
getCard();
setCardScore();
playerAce += getAce();
int cardScore = getCardScore();
mPlayerScore = cardScore;
int nkar = getFace();
int mast = getSuit();
std::string nkarner[ 13 ] = { "Tuz", "2", "3", "4", "5", "6", "7",
"8", "9", "10", "Valet", "Dama", "Karol" };
std::string master[ 4 ] = { "Srti ", "Qyapi ", "Xari ", "Xachi " };

std::cout << master[ mast ] << nkarner[ nkar ]
<< "\t" << "@ndhanur achokner: " << getPlayerScore() << std::endl;
Sleep(1000);

}

Добавлено (16.07.2012, 00:14)
---------------------------------------------
// 21.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include "card.h"
#include "player.h"
#include "comp.h"

int _tmain(int argc, _TCHAR* argv[])
{
std::string name;
std::cout << "Anun: ";
std::cin >> name;
player player1;
player1.setName( name );

std::cout << "********** XAXUMENQ 21 " << player1.getName()
<< " **********" << std::endl << std::endl;

player1.getCard();
player1.playerResult();
int playerKey = 0;

do
{
playerKey = 0;
std::cout << "\n\n'1' eli kart vercnel, '2' heriqa: ";
std::cin >> playerKey;

if( playerKey == 2 )
{
std::cout << "\nSpasi compin\n\n";
break;
}

if( playerKey == 1 )
{
player1.getCard();
player1.playerResult();
if( player1.getPlayerScore() > 21 )
{
std::cout << "\n\nAncar 21@\nHaxtec comp@! " << std::endl << std::endl;
system("pause");
exit( 1 );
}

if( player1.getPlayerScore() == 21 || ( player1.getPlayerScore() == 22 && player1.getPlayerAce() == 2 ) )
{
std::cout << "\n\n********** " << player1.getName()
<< " du haxtecir!!! **********" << std::endl << std::endl;
system("pause");
exit( 1 );
}
}

} while( true );

comp Comp;
while( Comp.getCompScore() <= player1.getPlayerScore() )
{
Comp.getCard();
Comp.compResult();
if( Comp.getCompScore() == 21 || ( Comp.getCompScore() == 22 && Comp.getCompAce() == 2 ) )
{
std::cout << "\n\nHaxtec comp@" << std::endl << std::endl;
system("pause");
exit( 1 );
}

if( Comp.getCompScore() > 21 )
{
std::cout << "\n\n********** " << player1.getName() << " du haxtecir **********" << std::endl << std::endl;
system("pause");
exit( 1 );
}

if( Comp.getCompScore() >= player1.getPlayerScore() )
{
std::cout << "\n\nHaxtec comp@" << std::endl << std::endl;
system("pause");
exit( 1 );
}
}



std::cout << std::endl;
system("pause");
return 0;
}

Добавлено (16.07.2012, 00:14)
---------------------------------------------
@h@@@@@@@@@@@@N :D

 
  • Страница 3 из 4
  • «
  • 1
  • 2
  • 3
  • 4
  • »
Поиск:


Кто нас сегодня посетил