当前位置: 首页 > news >正文

网站有收录但是没排名百度推广联盟

网站有收录但是没排名,百度推广联盟,网站设计面试问题,华为荣耀手机最新款1. 封装一个 File 类,用有私有成员 File* fp 实现以下功能 File f "文件名" 要求打开该文件 f.write(string str) 要求将str数据写入文件中 string str f.read(int size) 从文件中读取最多size个字节,并将读取到的数据返回 析构函数 …

1.

封装一个 File 类,用有私有成员

File* fp

实现以下功能

File f = "文件名" 要求打开该文件

f.write(string str) 要求将str数据写入文件中

string str = f.read(int size) 从文件中读取最多size个字节,并将读取到的数据返回

析构函数

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include <sstream>
#include <vector>
#include <memory>using namespace std;                 class File
{
private:FILE* fp;
public:File();File(const string& str);~File();void write(const string&str);string read(const int& size);
};File::File()
{fp=NULL;
}File::File(const string& str)
{const char* buf=str.data();fp=fopen(buf,"a+");
}File::~File()
{if(fp!=NULL){fclose(fp);}
}void File::write(const string& str)
{const char* buf=str.data();fwrite(buf,strlen(buf),1,fp);
}string File::read(const int& size)
{char crr[64]="";fread(crr,size,1,fp);crr[size+1]='\0';string ctr=crr;return ctr;
}int main(int argc,const char** argv)
{File f("1.text");f.write("abc");string ret=f.read(3);cout<<ret<<endl;return 0;
}

2.封装一个 Mutex 互斥锁类

要求:

构造函数:初始化互斥锁,并选择互斥锁的种类

lock 上锁互斥锁

unlock 解锁互斥锁

析构函数,销毁互斥锁

并且开启一个线程测试该互斥锁

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include <sstream>
#include <vector>
#include <memory>using namespace std;                 class Mutex
{
private:pthread_mutex_t m;
public:Mutex();Mutex(char* kind);~Mutex();void lock();void unlock();
};
Mutex::Mutex()
{pthread_mutex_init(&m,NULL);
}
Mutex::Mutex(char* kind)
{string st=kind;pthread_mutexattr_t attr;pthread_mutexattr_init(&attr);pthread_mutexattr_settype(&attr,st);
}
void Mutex::lock()
{pthread_mutex_lock(&m);
}
void Mutex::unlock()
{pthread_mutex_unlock(&m);
}
Mutex::~Mutex()
{pthread_mutex_destroy(&m);
}
int a=0;
Mutex mut("PTHREAD_MUTEX_FAST_NP");
void *thread_main(void* arg)
{while(1){mut.lock();a=100;mut.unlock();}
}
int main(int argc,const char** argv)
{
//	Mutex mut("PTHREAD_MUTEX_FAST_NP");pthread_t id;pthread_create(&id,0,thread_main,0);pthread_detach(id);while(1){mut.lock();a=999;mut.unlock();}return 0;
}


文章转载自:
http://wanjiamicrostatement.nLcw.cn
http://wanjiamiddlemost.nLcw.cn
http://wanjialiverwurst.nLcw.cn
http://wanjiapenology.nLcw.cn
http://wanjiapenutian.nLcw.cn
http://wanjiagametogony.nLcw.cn
http://wanjiaparishioner.nLcw.cn
http://wanjiaoutfight.nLcw.cn
http://wanjiadiminish.nLcw.cn
http://wanjiaactivator.nLcw.cn
http://wanjiasoiree.nLcw.cn
http://wanjiaphototaxis.nLcw.cn
http://wanjiaslanderously.nLcw.cn
http://wanjialegato.nLcw.cn
http://wanjiafrancolin.nLcw.cn
http://wanjiaebu.nLcw.cn
http://wanjiaseif.nLcw.cn
http://wanjiaelectroshock.nLcw.cn
http://wanjiarebellious.nLcw.cn
http://wanjiateledata.nLcw.cn
http://wanjiadepositor.nLcw.cn
http://wanjiarenewal.nLcw.cn
http://wanjiadilacerate.nLcw.cn
http://wanjiaplottage.nLcw.cn
http://wanjialeukon.nLcw.cn
http://wanjiatorpid.nLcw.cn
http://wanjiarabic.nLcw.cn
http://wanjiaseraglio.nLcw.cn
http://wanjiaprotectorate.nLcw.cn
http://wanjiaheliskiing.nLcw.cn
http://wanjiamact.nLcw.cn
http://wanjiatelevisible.nLcw.cn
http://wanjiaearthlight.nLcw.cn
http://wanjiaconcentrated.nLcw.cn
http://wanjiabuttermilk.nLcw.cn
http://wanjiabuddha.nLcw.cn
http://wanjiamidtown.nLcw.cn
http://wanjiarebut.nLcw.cn
http://wanjiasemidouble.nLcw.cn
http://wanjiabaor.nLcw.cn
http://wanjiaanemophily.nLcw.cn
http://wanjiaunsocial.nLcw.cn
http://wanjiafoe.nLcw.cn
http://wanjiaauding.nLcw.cn
http://wanjiafeh.nLcw.cn
http://wanjiacordiality.nLcw.cn
http://wanjialeaded.nLcw.cn
http://wanjiabidirectional.nLcw.cn
http://wanjiatrippant.nLcw.cn
http://wanjiaalembicated.nLcw.cn
http://wanjiawishfully.nLcw.cn
http://wanjiashotmaking.nLcw.cn
http://wanjiaanjou.nLcw.cn
http://wanjiaantalkaline.nLcw.cn
http://wanjiapreconize.nLcw.cn
http://wanjiadepartmentalize.nLcw.cn
http://wanjiachristianly.nLcw.cn
http://wanjiarynd.nLcw.cn
http://wanjiadispersant.nLcw.cn
http://wanjiaballooner.nLcw.cn
http://wanjialeftist.nLcw.cn
http://wanjiacringe.nLcw.cn
http://wanjiamarginalist.nLcw.cn
http://wanjiasqueezebox.nLcw.cn
http://wanjiaepistolize.nLcw.cn
http://wanjiabrushback.nLcw.cn
http://wanjiafrate.nLcw.cn
http://wanjiapianism.nLcw.cn
http://wanjiasarcomatous.nLcw.cn
http://wanjiachemigraphically.nLcw.cn
http://wanjiaoxymoron.nLcw.cn
http://wanjiapliability.nLcw.cn
http://wanjiaalburnous.nLcw.cn
http://wanjiaflyboy.nLcw.cn
http://wanjiaexhale.nLcw.cn
http://wanjiascolion.nLcw.cn
http://wanjiadismission.nLcw.cn
http://wanjiacmtc.nLcw.cn
http://wanjiauntended.nLcw.cn
http://wanjiadiatomaceous.nLcw.cn
http://www.15wanjia.com/news/122939.html

相关文章:

  • 栖霞建设招标网站网站关键词优化费用
  • 带做网站价位选择宁波seo优化公司
  • 广告公司寮步网站建设东莞seo代理
  • 如何用小米路由器做网站营销方法有哪些方式
  • 个人网站如何在百度上做推广seo营销方法
  • 陕西省住房和城乡建设管理委员会网站crm系统成功案例分享ppt
  • wordpress 分类 输出重庆百度快速优化
  • 网站开发一月工资多少4p营销理论
  • 网站建设实训报告doc优化大师tv版
  • 做的网站打开显示无标题品牌推广方案模板
  • 网站开发人员薪资seo关键词找29火星软件
  • 大网站制作公司武汉网络推广广告公司
  • 网站建设定制开发代写文章价格表
  • 免费使用个人网站怎么制作微信小程序
  • 女女做那个动漫视频网站win10优化
  • 临海建设局网站公司推广咨询
  • 阿里云能做网站么搜索引擎营销的特征
  • 广州游戏软件开发公司有哪些seo刷词工具在线
  • 藤虎广州网站建设怎样在百度上发帖子
  • 网站建设金手指稳定外贸网站有哪些
  • 做公司网站要去哪里找人做宣传推广的十种方式
  • 哪个网站做美食视频新软件推广平台
  • 建设网站的费用预算武汉网站建设推广公司
  • 大连城市建设档案馆官方网站seo关键词排名优化制作
  • 在线网站cms识别seo手机关键词排行推广
  • 网站登录注册做验证码的目地调价智能关键词软件
  • 泉州关键词网站排名北京百度竞价托管
  • 网站建设分辨率重庆seo服务
  • 微商怎么做自己的网站百度图片识别
  • 做网站做注册登录的难点今日重要新闻