仿百家号wordpress主题,天津百度seo排名优化软件,房地产网站编辑,如何做好网站seo#include iostream
#include regexusing namespace std;int main() {
//它声明了一个 string 类型的变量 input#xff0c;用于存储输入的字符串。然后使用 getline() 函数从标准输入中读取一行输入#xff0c;并将其存储在 input 变量中。string input;getl… #include iostream
#include regexusing namespace std;int main() {
//它声明了一个 string 类型的变量 input用于存储输入的字符串。然后使用 getline() 函数从标准输入中读取一行输入并将其存储在 input 变量中。string input;getline(cin, input); // 从标准输入读取一行输入并将其存储在input变量中regex letterRegex([a-zA-Z]); // 匹配任何字母的正则表达式regex digitRegex([0-9]); // 匹配任何数字的正则表达式regex spaceRegex(\\s); // 匹配任何空白字符的正则表达式int letterCount 0; // 字母计数器int digitCount 0; // 数字计数器int spaceCount 0; // 空格计数器int otherCount 0; // 其他字符计数器//这部分代码定义了四个计数器变量letterCount 用于记录字母的数量digitCount 用于记录数字的数量spaceCount 用于记录空格的数量otherCount 用于记录其他字符的数量。for (char c : input) {string s(1, c); // 将字符转换为单字符的字符串if (regex_match(s, letterRegex)) {letterCount; // 如果匹配字母正则表达式则字母计数器递增} else if (regex_match(s, digitRegex)) {digitCount; // 如果匹配数字正则表达式则数字计数器递增} else if (regex_match(s, spaceRegex)) {spaceCount; // 如果匹配空白字符正则表达式则空格计数器递增} else {otherCount; // 否则其他字符计数器递增}}
//这部分代码使用一个范围-based 的 for 循环遍历输入字符串中的每个字符。对于每个字符它将其转换为一个单字符的字符串 s。然后使用 regex_match() 函数分别与 letterRegex、digitRegex 和 spaceRegex 进行匹配。如果匹配成功则相应的计数器递增如果没有匹配成功则 otherCount 计数器递增。cout letterCount digitCount spaceCount otherCount endl; // 输出字母、数字、空格和其他字符的计数结果使用空格分隔它们并在最后添加换行符return 0;
} #include iostream
#define LEAP_YEAR(y) ((y%40y%100!0)||(y%4000))
using namespace std;int main() {int year;cin year;cout (LEAP_YEAR(year) 1 ? L : N);return 0;
} #include iostream#include iomanip#define Y(a,b,c) (ab?(ac?a:c):(bc?b:c))double wmw(double a,double b,double c){return ab?(ac?a:c):(bc?b:c);}using namespace std;int main(){double a,b,c;cinabc;coutfixedsetprecision(3)wmw(a,b,c)endl;coutfixedsetprecision(3)Y(a,b,c)endl;} #includeiostream
using namespace std;
struct OurLostTime{int year;int month;int day;
};
int main()
{int days[13]{0,31,28,31,30,31,30,31,31,30,31,30,31};OurLostTime nowadays;cinnowadays.yearnowadays.monthnowadays.day;if((nowadays.year%40nowadays.year%100!0)||(nowadays.year%4000)){days[2]29;}int Lostdays0;for (int i 0; i nowadays.month ; i) {Lostdaysdays[i];}Lostdaysnowadays.day;coutLostdaysendl;return 0;
} printf(%o, num); %x %d #include iostream
#include iomanip
using namespace std;int main() {double f;cin f;cout fixed setprecision(2); // 设置输出精度为两位小数if (f 10)cout 3 * f - 11;else if (f 1)cout 2 * f - 1;elsecout f;return 0;
}