Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- void mostMet(char* uniMnoj, char* sub, int* posArr,int posSize)
- {
- cout << endl << strlen(sub) << endl;
- int tempcnt = 0;
- for(int i = 10;i > 0;--i){
- if (tempcnt < posSize)
- {
- if (sub[i] == '1')
- {
- posArr[tempcnt] = i;
- tempcnt++;
- }
- else
- {
- continue;
- }
- }
- else
- {
- break;
- }
- }
- cout << "The last " << posSize << " symbols are: ";
- int counter2 = 0;
- for (int i = 0 ; i < tempcnt; i++)
- {
- int tmptocout = posArr[counter2];
- cout << uniMnoj[tmptocout];
- counter2++;
- }
- cout << endl;
- }
- int main()
- {
- //zadacha stringove
- // v sluchiq namirane na poslednite tri indeksa na stringa
- char uniMnoj[] = { 'e','r','D','U','w','m','B','x','N','Z' };
- char bitmask[] = { "1111001010" };
- int lastWords = 0;
- cout << "Vuvedete kolko ot poslednite bukvi iskate da izpechatam " << endl;
- cin >> lastWords;
- int* posArr = new int[lastWords];
- mostMet(uniMnoj, bitmask, posArr, lastWords);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement