Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <math.h>
- int N = 10;
- void swap(int* xp, int* yp)
- {
- int temp = *xp;
- *xp = *yp;
- *yp = temp;
- }
- void bubbleSort(int arr[], int n)
- {
- int i, j;
- for (i = 0; i < N - 1; i++)
- // Last i elements are already in place
- for (j = 0; j < n - i - 1; j++)
- if (arr[j] > arr[j + 1])
- swap(&arr[j], &arr[j + 1]);
- }
- int main()
- {
- int i;
- std::ofstream out; // поток для записи
- out.open("C:\\Users\nekogen\desktop\semestr.txt"); // окрываем файл для записи
- if (out.is_open())
- {
- for(i=0; i <= N; i++)
- {
- out << "A" << std::endl;
- }
- }
- std::cout << "End of program" << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement