Nomlar maydoni bu uning ichidagi identifikatorlar (turlar, funktsiyalar, o'zgaruvchilar va boshqalar nomlari) qamrovini ta'minlaydigan deklarativ hudud



Download 34,06 Kb.
bet4/4
Sana06.07.2022
Hajmi34,06 Kb.
#749870
1   2   3   4
Bog'liq
1-Mustaqil ish

Nomlar maydoni taxalluslari


Nomlar maydoni nomlari noyob bo'lishi kerak, ya'ni ular ko'pincha juda qisqa bo'lmasligi kerak. Agar ismning uzunligi kodni o'qishni qiyinlashtirsa yoki direktivalardan foydalanish mumkin bo'lmagan sarlavha fayliga yozish zerikarli bo'lsa, siz haqiqiy ismning qisqartmasi bo'lib xizmat qiladigan nomlar maydoniga taxallus yaratishingiz mumkin. Masalan:
namespace a_very_long_namespace_name { class Foo {}; }
namespace AVLNN = a_very_long_namespace_name;
void Bar(AVLNN::Foo foo){ }

anonim yoki nomsiz fazolar


Siz aniq nom maydoni yaratishingiz mumkin, lekin unga nom bermaysiz:
namespace
{
int MyFunc(){}
}
Bu nomsiz yoki anonim nom maydoni deb ataladi va siz o'zgaruvchilar deklaratsiyasini boshqa fayllardagi kodga ko'rinmas holga keltirmoqchi bo'lsangiz (ya'ni, ularga ichki bog'lanishni) nomli nomlar maydoni yaratmasdan foydali bo'ladi. Xuddi shu fayldagi barcha kod identifikatorlarni nomsiz nomlar maydonida ko'rishi mumkin, ammo identifikatorlar nom maydonining o'zi bilan birga ushbu fayldan tashqarida, aniqrog'i tarjima birligidan tashqarida ko'rinmaydi.
Labaratoriya topshiriqlari(Amaliy)
#include
#include
#include
#include
#include
#include
using namespace std;
int main()
{


string next;
string teams[10] = {"Clemson" , "Alabama" , "Georgia" , "Florida" , "Notre Dame" , "Auburn" , "Oklahoma" , "LSU" , "Miami FL" , "Oklahoma State"};
int select, ranking, teamoverall, wins, losses;
string team1, team2, userteam, nextgame;
int Alabama = 92;
int Clemson = 90;
int Georgia = 93;
int NotreDame = 88;
int MiamiFL = 80;
int Auburn = 86;
int Oklahoma = 85;
int LSU = 82;
int Florida = 90;
int OklahomaST = 78;
int Kansas = 60;
int Kentucky = 60;
int TexasAM = 65;
float score, oppscore;
int final, oppfinal, random, random1;


team1 = "Arkanasas";
team2 = "Oklahoma State";

wins = 0;
losses = 0;
cout << "COLLEGE FOOTBALL COACH - 2020" << endl;
cout << "1 - Manage" << endl;
cout << "2 - Manual" << endl;
cout << "3 - About" << endl;
cin >> select;
if(select == 1){
goto TeamSelect;
}
if(select ==2){
goto Manual;
}
if(select == 3){
goto About;
}

TeamSelect:
cout << string( 100, '\n' );
cout << "Choose a starting school to coach" << endl;
cout << "1- " << team1 << endl << "2- " << team2 << endl;
cin >> select;
if(select == 1){
userteam = "Arkansas";
ranking = 15;
nextgame = "Georgia";
teamoverall = 55;
}else{
userteam = "Oklahoma State";
ranking = 10;
nextgame = "Kansas";
teamoverall = 78;
}
goto Dynasty;


Dynasty:
cout << string( 100, '\n' );
cout << "Team - " << userteam << endl << endl;
cout << "Next Game - " << nextgame << " | Opponent Overall - ";
if(nextgame == "Georgia"){
cout << Georgia << endl << endl;
}else{
if(nextgame == "Kansas"){
cout << Kansas << endl << endl;
}else{
if(nextgame == "Kentucky"){
cout << Kentucky << endl << endl;
}else{
if(nextgame == "Auburn"){
cout << Auburn << endl << endl;
}else{
if(nextgame == "LSU"){
cout << LSU << endl << endl;
}else{
if(nextgame == "Texas A&M"){
cout << TexasAM << endl << endl;
}
}
}
}
}
}


cout << "Ranking - ";
if(ranking < 11){
cout << ranking << endl << endl;
}else{
cout << "UNRANKED" << endl << endl;
}
cout << "Record" << "(" << wins << " - " << losses << ")" << endl << endl;
cout << "Team Overall - " << teamoverall << endl << endl;
cout << "1- Play Next Game" << endl;
cout << "2- Recruting" << endl;
cout << "3- Rankings" << endl;
cin >> select;
if(select == 3){
goto rankings;
}else if(select ==1){
goto playgame;
}

playgame:
cout << string( 100, '\n' );
if(userteam == "Arkansas"){
if(nextgame == "Georgia"){
score = teamoverall * .5;
srand (time(NULL));
random = rand() % 5 + -20;
srand (time(NULL));
random1 = rand() % 20 + 1;
random = random + random1;

score = score + random;

oppscore = Georgia * .5;
srand (time(NULL));
random = rand() % 5 + -20;
srand (time(NULL));
random1 = rand() % 25 + 1;
random = random + random1;

oppscore = oppscore + random;

final = score;
oppfinal = oppscore;

if(final == oppfinal){
goto playgame;
}

if(final < 0){
final = 0;
}
if(oppfinal < 0){
oppfinal = 0;
}
if(final == 1){
final == 3;
}
if(final == 1){
final == 3;
}
if(oppfinal ==1){
oppfinal == 3;
}
if(score>oppscore){
wins = wins + 1;
teamoverall = teamoverall + 2;
}else{
losses = losses +1;
teamoverall = teamoverall - 2;
}

cout << "Arkansas scored " << final << " | Georgia scored " << oppfinal << endl << endl;
nextgame = "Kentucky";

cout << "Type 1 and press enter to continue..." << endl;
cin >> select;
goto Dynasty;

}else{
if(nextgame == "Kentucky"){
score = teamoverall * .5;
srand (time(NULL));
random = rand() % 5 + -20;
srand (time(NULL));
random1 = rand() % 20 + 1;
random = random + random1;

score = score + random;

oppscore = Kentucky * .5;
srand (time(NULL));
random = rand() % 10 + -25;
srand (time(NULL));
random1 = rand() % 25 + 1;
random = random + random1;

oppscore = oppscore + random;

final = score;
oppfinal = oppscore;

if(final == oppfinal){
goto playgame;
}


if(final < 0){
final = 0;
}
if(oppfinal < 0){
oppfinal = 0;
}
if(final == 1){
final == 3;
}
if(oppfinal ==1){
oppfinal ==3;
}

if(score>oppscore){
wins = wins + 1;
teamoverall = teamoverall + 2;
}else{
losses = losses +1;
teamoverall = teamoverall - 2;
}
cout << "Arkansas scored " << final << " | Kentucky scored " << oppfinal << endl << endl;
nextgame = "Auburn";
cout << "Type 1 and press enter to continue..." << endl;
cin >> select;
goto Dynasty;
}else{
if(nextgame == "Auburn"){
cout << string( 100, '\n' );
score = teamoverall * .5;
srand (time(NULL));
random = rand() % 5 + -25;
srand (time(NULL));
random1 = rand() % 20 + 1;
random = random + random1;

score = score + random;

oppscore = Auburn * .5;
srand (time(NULL));
random = rand() % 1 + -20;
srand (time(NULL));
random1 = rand() % 20 + 1;
random = random + random1;

oppscore = oppscore + random;

final = score;
oppfinal = oppscore;


if(final < 0){
final = 0;
}
if(oppfinal < 0){
oppfinal = 0;
}
if(final == 1){
final == 3;
}
if(oppfinal ==1){
oppfinal == 3;
}

if(final == oppfinal){
goto playgame;
}

if(score>oppscore){
wins = wins + 1;
teamoverall = teamoverall + 2;
}else{
losses = losses +1;
teamoverall = teamoverall - 2;
}

cout << "Arkansas scored " << final << " | Auburn scored " << oppfinal << endl << endl;
nextgame = "LSU";

cout << "Type 1 and press enter to continue..." << endl;
cin >> select;
goto Dynasty;
}else{
if(nextgame == "LSU"){
cout << string( 100, '\n' );
score = teamoverall * .5;
srand (time(NULL));
random = rand() % 5 + -15;
srand (time(NULL));
random1 = rand() % 25 + 1;
random = random + random1;

score = score + random;

oppscore = LSU * .5;
srand (time(NULL));
random = rand() % 1 + -20;
srand (time(NULL));
random1 = rand() % 25 + 1;
random = random + random1;

oppscore = oppscore + random;

final = score;
oppfinal = oppscore;


if(final < 0){
final = 0;
}
if(oppfinal < 0){
oppfinal = 0;
}
if(final == 1){
final == 3;
}
if(oppfinal ==1){
oppfinal ==3;
}

if(final == oppfinal){
goto playgame;
}

if(score>oppscore){
wins = wins + 1;
teamoverall = teamoverall + 2;
}else{
losses = losses +1;
teamoverall = teamoverall - 2;
}

cout << "Arkansas scored " << final << " | LSU scored " << oppfinal << endl << endl;
nextgame = "Texas A&M";

cout << "Type 1 and press enter to continue..." << endl;
cin >> select;
goto Dynasty;
}else{
if(nextgame == "Texas A&M"){
cout << string( 100, '\n' );
score = teamoverall * .5;
srand (time(NULL));
random = rand() % 10 + -20;
srand (time(NULL));
random1 = rand() % 30 + 1;
random = random + random1;

score = score + random;

oppscore = TexasAM * .5;
srand (time(NULL));
random = rand() % 5 + -15;
srand (time(NULL));
random1 = rand() % 20 + 1;
random = random + random1;

oppscore = oppscore + random;

final = score;
oppfinal = oppscore;


if(final < 0){
final = 0;
}
if(oppfinal < 0){
oppfinal = 0;
}
if(final == 1){
final == 3;
}
if(oppfinal ==1){
oppfinal = 3;
}

if(final == oppfinal){
goto playgame;
}

if(score>oppscore){
wins = wins + 1;
teamoverall = teamoverall + 2;
}else{
losses = losses +1;
teamoverall = teamoverall - 2;
}

cout << "Arkansas scored " << final << " | Texas A&M scored " << oppfinal << endl << endl;
nextgame = "Texas A&M";

cout << "Type 1 and press enter to continue..." << endl;
cin >> select;
goto Dynasty;
}
}
}
}
}
}








rankings:
cout << string( 100, '\n' );
cout << "1- " << teams[0] << endl;
cout << "2- " << teams[1] << endl;
cout << "3- " << teams[2] << endl;
cout << "4- " << teams[3] << endl;
cout << "5- " << teams[4] << endl;
cout << "6- " << teams[5] << endl;
cout << "7- " << teams[6] << endl;
cout << "8- " << teams[7] << endl;
cout << "9- " << teams[8] << endl;
cout << "10- " << teams[9] << endl;
cout << "Type 1 and press enter to go back..." << endl;
cin >> select;
goto Dynasty;
Manual:
cin >> select;
About:
cin >> select;

}

Download 34,06 Kb.

Do'stlaringiz bilan baham:
1   2   3   4




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish