Results 1 to 10 of 10
Thread: C++
Hybrid View
-
13th January 2021 16:15 #1Registered User
Join Date: Jan:2021
Location: Sofia
Posts: 3
C++
. .
:
1. : , , . :
) .
) .
) ( .) .
) .
. :
.Code:#include <iostream> #include <string.h> #include <stdlib.h> using namespace std; //Zadavane na primerni danni za vhod v sistemata char user[] = "admin"; // Potrebitel char pass[] = "12345"; // Parola char username[20]; //Maksimalna duljina na potrebitelsko ime char password[20]; //Maksimalna duljina na parola //Nachalo na pokazvane na vhodnata stranica void showMenu (); //Nachalo proverka na parola void passCheck (); //Nachalo na programa int main(){ showMenu(); passCheck(); } //Izvejdane na menu za vhod void showMenu(){ //Bot Check Proverka chrez natiskane na Enter ot klaviaturata cout <<"Dobre doshli v sistemata online shop natisnete 'Enter' za da produljite"; cin.get (); //Izvejdane na menu za vuvejdane na potrebitelsko ime cout << "Vuvedete Potrebitelsko ime (admin): "; //Vuvejdane na potrebitelsko ime cin >> username; cin.ignore (); //Izvejdane na menu za vuvejdane na parola cout << "Vuvedete Parola (12345): "; //Vuvejdane na parola cin >> password; cin.ignore (); } //Nachalo na menu za vhod pri greshno vuvedeni potrebitel ili parola void showMenufailed(){ //Izvejdane na menu za vuvejdane na potrebitelsko ime cout << "Vuvedete Potrebitelsko ime (admin): "; //Vuvejdane na potrebitelsko ime cin >> username; cin.ignore(); //Izvejdane na menu za vuvejdane na parola cout << "Vuvedete Parola (12345): "; //Vuvejdane na parola cin >> password; cin.ignore(); } //Nachalo na funkciq za proverka na parola void passCheck(){ //Proverka za vuvedeno potrebitelsko ime i parola razlichni ot prazno i suotvetsvashti na zadadenite potrebitel i parola if (strcmp (user, username) == 0 && strcmp (pass, password) == 0){ cout << "LogIn Successful natisnete 'Enter' za da produljite"; cin.get (); //Nachalo na izgrajdane i strukturirane na masiv struct shop{ char ProductName[255]; char ProductID[255]; char Category[255]; char price[255]; }; //nachalo na parametri na broq artikuli v masiva shop items[50], pom; int n; // deistvitelen broi int i; //Vuvejdane na broi artikuli max 50 cout << " Vuvedete broi na artikulite n <= 50 :"; cin >> n; //Vuvejdane na stoinosti v masiva for (i = 0; i < n; i++){ cout << "Vuvedete Ime:"; //Ime na artikul cin >> items[i].ProductName; cout << "Vuvedete Kod: "; //Kod na artikula cin >> items[i].ProductID; cout << "Vuvedete Kategoria: "; //Vuvejdane na kategoria cin >> items[i].Category; cout << "Vuvedete Cena: "; //Vuvejdane na cena cin >> items[i].price; } int j; //nachalo na sortirane for (i = 0; i < n - 1; i++) for (j = i + 1; j < n; j++) if (items[i].price < items[j].price){ pom = items[i]; items[i] = items[j]; items[j] = pom; } for (i = 0; i < n; i++){ //izvejdane na masiva cout << " Ime : " << items[i].ProductName << endl; //Ime na artikula cout << " Kod : " << items[i].ProductID << endl; //Kod na artikula cout << " Kategoria : " << items[i].Category << endl; //Kategoriq na artikula cout << " Cena : " << items[i].price << endl << endl; //Cena na artikula } } //Pri Gtrdhno vuvedeni potrebitel i parola vrushtane kum menuto za vuvejdane na potrebitel i parola else{ cout <<"LogIn Failed! Greshen Potrebitel i/ili Parola natisnete 'Enter' za vrushtane kum menuto za vhod. "; cin.get (); showMenufailed (); passCheck (); } }
Code:int j; //nachalo na sortirane for (i = 0; i < n - 1; i++) for (j = i + 1; j < n; j++) if (items[i].price < items[j].price){ pom = items[i]; items[i] = items[j]; items[j] = pom; } for (i = 0; i < n; i++){ //izvejdane na masiva cout << " Ime : " << items[i].ProductName << endl; //Ime na artikula cout << " Kod : " << items[i].ProductID << endl; //Kod na artikula cout << " Kategoria : " << items[i].Category << endl; //Kategoriq na artikula cout << " Cena : " << items[i].price << endl << endl; //Cena na artikula }
, "" ""
, ?
.
-
13th January 2021 20:29 #2Registered User
Join Date: Dec:2020
Location: Razgrad
Posts: 2,037
, . . , . - , , . "Y" - , - .
-
15th January 2021 02:23 #3Registered User
Join Date: Jan:2021
Location: Sofia
Posts: 3
,
!Code://nachalo na parametri na broq artikuli v masiva shop items[50], pom; int n; // deistvitelen broi int i; int order; //promenliva za nachin na podrejdane. int pmax; //promenliva za maximalna stoinost na cenovi diapazon. int pmin; //promenliva za minimalna stoinost na cenovi diapazon. cout << "izberete tipa na sortirane:" <<endl; cout << "sortirane po cena nizhodqshto vuvedete '1'" <<endl; cout << "sortirane po cena vuzhodqshto vuvedete '2'" <<endl; cout << "sortirane po cenovi diapazon vuvedete '3'" <<endl; cout << "izberete metod na sortirane:"; cin >> order; if(order == 3){ cout << "vuvedete minimalna suma:"; cin >> pmin; cout << "vuvedete maximalna suma:"; cin >> pmax; } //Vuvejdane na broi artikuli max 50 cout << " Vuvedete broi na artikulite n <= 50 :"; cin >> n; //Vuvejdane na stoinosti v masiva for (i = 0; i < n; i++){ cout << "Vuvedete Ime:"; //Ime na artikul cin >> items[i].ProductName; cout << "Vuvedete Kod: "; //Kod na artikula cin >> items[i].ProductID; cout << "Vuvedete Kategoria: "; //Vuvejdane na kategoria cin >> items[i].Category; cout << "Vuvedete Cena: "; //Vuvejdane na cena cin >> items[i].price; } int j; //nachalo na sortirane for (i = 0; i < n - 1; i++) for (j = i + 1; j < n; j++) if(order == 1){ if (items[i].price < items[j].price){ pom = items[i]; items[i] = items[j]; items[j] = pom; } }else if(order == 2){ if (items[i].price > items[j].price){ pom = items[i]; items[i] = items[j]; items[j] = pom; } }else if(order == 3){ if (items[i].price >= pmin && items[i].price == pmax){ pom = items[i]; items[i]; items[j] = pom; } } for (i = 0; i < n; i++){ //izvejdane na masiva cout << " Ime : " << items[i].ProductName << endl; //Ime na artikula cout << " Kod : " << items[i].ProductID << endl; //Kod na artikula cout << " Kategoria : " << items[i].Category << endl; //Kategoriq na artikula cout << " Cena : " << items[i].price << endl << endl; //Cena na artikula } }





-
15th January 2021 02:27 #4Product of Science
Join Date: Aug:2016
Location:
Posts: 294
, :
, , , ( ), , ., ,
-
15th January 2021 02:46 #5Registered User
Join Date: Jan:2021
Location: Sofia
Posts: 3
? ___ CMS Socialengine 3 ! ! ... !
http://www.socialengineforum.com/ind...5663&hl=reasse
http://www.socialengineforum.com/ind...se#entry115826
http://www.socialengineforum.com/ind...se#entry116849
! ... .... ...Last edited by reasse; 15th January 2021 at 02:47.
-
15th January 2021 05:55 #6Product of Science
Join Date: Aug:2016
Location:
Posts: 294
C++ , . , , .
, :
6) Do NOT expect members here to do your homework for you. Do NOT just post the problem (#2), leave, and expect someone to post the solution by the time you return. Members here are discouraged from doing this, as it doesn't help anyone, and may even harm by preventing you from learning what you are supposed to learn.( , , , )6) . (# 2), , . , , , ., ,




Reply With Quote

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in