Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <string.h>
- char a[22] = "SONY";
- ///////////////////////////////////////////////////////////////
- int main() //
- {
- strcpy(a, "Dima - Dima");
- int sizeStr = strlen(a);
- printf("sizeStr = %d\n ", sizeStr);
- for(int i = 0; i < 20; i++)
- {
- printf("%c, ", a[i] );
- }
- printf("\n");
- for (int i = 0; i < 20; i++)
- {
- printf("%x - %d\n", &a[i], &a[i]);
- }
- }
- /*
- #include <iostream>
- #include <cstdlib>
- #include <cstdio>
- #include <ctime>
- using namespace std;
- int a[22];
- ///////////////////////////////////////////////////////////////
- int main() //
- {
- srand(time(0));
- for (int i = 0; i < 20; i++)
- {
- a[i] = rand()%100;
- cout << a[i] << " ";
- }
- cout << endl;
- for (int i = 0; i < 20; i++)
- {
- printf("%x - %d\n", &a[i], &a[i]);
- }
- }
- */
- /*
- #include <iostream>
- #include <cstdlib>
- #include <ctime>
- using namespace std;
- void randomarray(int* a);
- ///////////////////////////////////////////////////////////////
- int main() //
- {
- int temp;
- int arr [20];
- randomarray(arr);
- for(int i = 0; i < 20/2; i++)
- {
- temp = arr[i];
- arr[i] = arr[20 - 1 - i];
- arr[20 - 1 - i] = temp;
- }
- for(int i = 0; i < 20; i++)
- {
- cout << arr[i] << " ";
- }
- }
- // Заполнение массива случайными числами.
- // И печать его содержимого в консоли.
- ///////////////////////////////////////////////////////////////
- void randomarray(int* a) //
- {
- srand(time(0));
- for (int i = 0; i < 20; i++)
- {
- a[i] = rand()%100;
- cout << a[i] << " ";
- }
- cout << endl;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement