Error] cannot pass objects of non-trivially-copyable type 'std::string {aka class std::basic_string<char>}' through '...'
Well, C functions are not acquainted with C++ structures. You should do the following:
...for(i = 0; i < 6; i++) { printf("Input the number for %s =", qr_naziv[i].c_str()); scanf("%d", &br_el[i]);}...
Notice the call to the method c_str()
on the each std::string qr_naziv[i]
, which returns a const char *
to a null-terminated character array with data equivalent to those stored in the string -- a C-like string.
Edit:And, of course, since you're working with C++, the most appropriate to do is to use the stream operators insertion <<
and extraction >>
, as duly noted by @MatsPetersson. In your case, you could do the following modification:
# include <iostream>...for(i = 0; i < 6; i++) { std::cout << "Input the number for " << qr_naziv[i] << " ="; std::cin >> br_el[i];}...