// Parse settings.data into separate variable
let settings_data = JSON.parse(settings.data);
// Update settings_data object by new value
settings_data.methodProperties.CityName="дол";
// Update settings.data by new stringified value
settings.data = JSON.stringify(settings_data);
// Test
alert(JSON.parse(settings.data).methodProperties.CityName);
6/6
5/6
4/6
6/6 * 5/6 * 4/6 = 120/216 = 5/9
-0.1 0.386718
0.0 0.400000
0.1 0.413278
0.2 0.426212
FILE* fptr;
float arg = 0.0;
float res = 0.0;
fptr = fopen("my.txt", "r");
if(fptr != NULL)
{
while(fscanf(fptr, "%f %f", &arg, &res) != EOF)
{
if(arg == 0.0)
{
printf("f(%.1f) : %f\n", arg, res);
}
}
}
fclose(fptr);
Мне нужно вывести в консоль строку с файла.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
string extract(string const& s, char first, char last)
{
auto lpos = s.find(first) + 1;
auto rpos = s.find(last, lpos);
return s.substr(lpos, rpos - lpos);
}
void print_if_contains(string const& s, char lp, string const& pattern, char rp)
{
if(extract(s, lp, rp) == pattern)
{
cout << s << "\n";
}
}
void print_if_contains(string const& s, char lp, double d, char rp)
{
if(stod(extract(s, lp, rp)) == d)
{
cout << s << "\n";
}
}
int main()
{
ifstream file("my.txt");
// ...
string line;
while(getline(file, line))
{
print_if_contains(line, '(', "0.0", ')');
print_if_contains(line, '(', 0.0, ')');
}
// ...
}