// 邮箱验证.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include<regex>
using namespace std;
//1、构造正则表达式
//2、调用regex_match(输入字符串,要求)
bool CheckEmail(char *userName)
{
//shouerzhushou@126.com.cn
//shouerzhushou@126.com
regex object("(\\w+)@(\\w+)(\\.(\\w+))+");
// “(\\w+)”表示 字母 a-z A-Z 或者数字 0-9 或者下划线
// +
bool result = regex_match(userName, object);
return result;
}
int main()
{
while (1)
{
char Email[20] = "";
cout << "请输入邮箱:";
cin >> Email;
if (CheckEmail(Email))
{
cout << Email << "是邮箱" << endl;
}
else
{
cout << Email << "不是邮箱" << endl;
}
}
system("pause");
return 0;
}
没有合适的资源?快使用搜索试试~ 我知道了~
简单的邮箱验证,C++

共17个文件
tlog:6个
vcxproj:1个
user:1个

需积分: 0 14 浏览量
2023-06-03
18:48:15
上传
评论
收藏 786KB ZIP 举报
温馨提示
C/C++学习成果
资源推荐
资源详情
资源评论




















收起资源包目录






















共 17 条
- 1
资源评论


买橘子送洗面奶
- 粉丝: 4
- 资源: 17
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制
