U
Size: a a a
U
ПК
add_library
не STATIC
а INTERFACE
должна быть у тебя. И строчка последняя лишняяПК
ПК
U
U
U
U
О
for (int i = 0; i < a.size(); i++)
{
if (a[i] == '.') i2 = i;
}
for (int i = 0; i < i2; i++)
{
result1 += (a[i] - '0') * pow(2, i2 - i - 1);
}
for (int i = i2 + 1; i < a.size(); i++)
{
result1 += (a[i] - '0') * pow(2, i2 - i);
}
U
for (int i = 0; i < a.size(); i++)
{
if (a[i] == '.') i2 = i;
}
for (int i = 0; i < i2; i++)
{
result1 += (a[i] - '0') * pow(2, i2 - i - 1);
}
for (int i = i2 + 1; i < a.size(); i++)
{
result1 += (a[i] - '0') * pow(2, i2 - i);
}
#pragma once
#include <sstream> // for std::stringstream
#include <string> // for std::string
namespace wear {
unsigned BinEcnode(unsigned translationValue) // Converting decimal code to binary
{
unsigned resultTranslateValue{ NULL };
unsigned d{ 1 };
while (translationValue > 0) {
resultTranslateValue += (translationValue % 2) * d;
translationValue = translationValue / 2;
d = d * 10;
}
return resultTranslateValue;
}
unsigned BinDecode(unsigned translationValue) // To convert the binary code to decimal code
{
unsigned resultTranslateValue{ NULL };
unsigned k{ 1 };
while (translationValue > 0) {
resultTranslateValue += (translationValue % 2) * k;
k *= 2;
translationValue = unsigned(translationValue / 10);
}
return resultTranslateValue;
}
std::string BinToHex(unsigned translationValue) // Converting binary / decimal code to hex
{
std::stringstream stream;
stream << "0x" << std::hex << translationValue;
return stream.str();
}
} // namespace wear
U
auto BinMulti(int binaryValue, int multValue)
{
return wear::BinEcnode(wear::BinDecode(binaryValue) * multValue);
}
U
О
NM
NM
D
NM
NM
Bar(string name, int value, string category) {
categoryPr = category;
namePr = name;
valuePr = value;
// this->value = value;
}
bool addBar(string name, int value, string category) {
while(capacity != size)
{
Bar(name, value, category);
size++;
if(capacity == size)
{
return false;
}
return true;
}
// return true; // TO DO: update this, it is only here so code compiles.
}
U
Bar(string name, int value, string category) {
categoryPr = category;
namePr = name;
valuePr = value;
// this->value = value;
}
bool addBar(string name, int value, string category) {
while(capacity != size)
{
Bar(name, value, category);
size++;
if(capacity == size)
{
return false;
}
return true;
}
// return true; // TO DO: update this, it is only here so code compiles.
}
NM
bc.addBar("Chicago", 1020, "US");
cout << "I am here!" << endl;
bc.addBar("NYC", 1300, "US");
cout << "I am here!" << endl;
bc.addBar("Paris", 1200, "France");
cout << "I am here!" << endl;
int n = bc.getSize();
for (int i = 0; i < n; i++) {
cout << bc[i].getName() << " ";
cout << bc[i].getValue() << " ";
cout << bc[i].getCategory();
cout << endl;
}
cout << "Size is: " << n << endl;
Object destroyed yo!!!
I am here!
Object destroyed yo!!!
I am here!
Object destroyed yo!!!
I am here!
0
0
0
Size is: 3