X = 2.5 * 2
X = 5.0 (float - вещественный)
X = 5 - 3.5
X = 1.5 (float - вещественный)
X = str(4 ** 5)
X = '1024' (str - строковый)
X = 5 * 4 < 10
X = False (bool - логический)
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct river{
string name;
double length;
double depth;
bool ships;
};
signed main(){
int n;
cin >> n;
river a[n];
for(int i = 0; i < n; i++)
cin >> a[i].name >> a[i].length >> a[i].depth >> a[i].ships;
vector<river> ans;
for(auto i: a)
if(i.length > 2 && i.ships)
ans.push_back(i);
for(auto i: ans){
cout << "name: " << i.name << "\n";
cout << "length: " << i.length << "\n";
cout << "depth: " << i.depth << "\n";
cout << "ships?: Yes";
}
}
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
struct river{
string name;
double length;
double depth;
bool ships;
};
signed main(){
int n;
cin >> n;
river a[n];
for(int i = 0; i < n; i++)
cin >> a[i].name >> a[i].length >> a[i].depth >> a[i].ships;
vector<river> ans;
for(auto i: a)
if(i.length > 2 && i.ships)
ans.push_back(i);
for(auto i: ans){
cout << "name: " << i.name << "\n";
cout << "length: " << i.length << "\n";
cout << "depth: " << i.depth << "\n";
cout << "ships?: Yes";
}
}
Вроде так, хотя могут быль ошибки после str