И это вприницпи работает. Как мне сделать так, что бы у каждого предмета можно было выставлять определённый коофицент выпадения? Или хотя бы подскажите куда копать, в каком направлении.
int val;
extern int val;
Чем обусловлена замена северного и южного моста чипсетом?Вопрос не имеет смысла.
void writeBinary(ostream& os, structBook const& book)
{
ostringstream ss;
ss << book.bookId
<< book.bookName.size() << book.bookName
<< book.bookAuthorName.size() << book.bookAuthorName
<< book.bookAuthorSurname.size() << book.bookAuthorSurname
<< book.year << book.pages << book.onplace
<< book.genre.size() << book.genre
<< book.section.size() << book.section;
os.write(reinterpret_cast<char*>(ss.str().size()), sizeof(decltype(ss.str().size())));
os.write(ss.str().data(), ss.str().size());
}
// ...
for(auto const& b : vecStructBook)
{
writeBinary(bookDatabase, b);
}
#include <algorithm>
#include <iterator>
#include <iostream>
#include <vector>
using namespace std;
auto fx = [](int x){
int r = 0;
switch(x % 3)
{
case 0:
r = x * x;
break;
case 1:
r = x;
break;
default:
r = x / 3;
break;
}
return r;
};
auto calculate = [](const vector<int>& vx, auto fx){
vector<int> calcValues(vx.size());
transform(vx.begin(), vx.end(), calcValues.begin(), fx);
return calcValues;
};
int main()
{
cout << "Введи кол-во чисел: ";
int n = 0;
cin >> n;
cout << "Введи через пробел " << n << " натуральных чисел:\n" << "$: ";
vector<int> values(n);
copy_n(istream_iterator<int>(cin), n, values.begin());
cout << "Результат твоих расчетов:\n";
copy_n(calculate(values, fx).begin(), n, ostream_iterator<int>(cout, "\n"));
}
Даны натуральные числа
Почему printf не выводит переменные?
printf("%s", "Znachenie", &p);
printf("%s %f", "Znachenie", p);
printf("Znachenie %f", p);
#include <iostream>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;
int main()
{
size_t n = 4;
string s = "42 54 35 76";
istringstream is(s);
vector<int> v;
copy_n(istream_iterator<int>(is), n, back_inserter(v));
/*******
** vector<int> v2(n);
** copy_n(istream_iterator<int>(is), n, v.begin());
*******/
copy_n(v.begin(), n, ostream_iterator<int>(cout, " "));
}
struct Data { short id; double val; };
я понимаю что 32 00 11 49 - это интовское значение
Как в данном выводе понять где выравнивание происходит?