文章 2012-08-09 来自:开发者社区

vc++实现文件关联

#include <stdio.h> #include <windows.h> int main(int argc,char *argv[]) { MessageBox(NULL,"Hello",NULL,MB_OK); char temp[256]; memset(temp,0,256); if(argc!=1){ int length =strlen(argv[1])....

文章 2012-07-22 来自:开发者社区

C++ 中cout<<endl的实现

话说像下面的语句,应该大家都明白这是通过重载operator <<函数来实现的。 cout<<123; cout<<"ssss"; 但是像 cout<<endl; 是怎样实现的? 起初猜想endl是一个class或者struct,再通过一个friend函数来实现的。 但是翻下stl的实现,原来endl是一个函数! template<ty...

文章 2012-06-18 来自:开发者社区

在VC++中实现渐变字

// 更改当前字体 LOGFONT lf; pDC->GetCurrentFont()->GetLogFont(&lf); CFont font, *pOldFont; lf.lfCharSet=134; lf.lfHeight=-150; lf.lfWidth=0; ...

文章 2012-06-16 来自:开发者社区

C++通过操作内存模拟序列化---实现多种类型的序列化(2)

昨天晚上写了部分序列化,结果睡着了....今天继续完善.. 明天的四级反正是裸考了,无所谓了 。。。。 昨天写的那个只能实现单一类型的简单序列化 ,但是原理却是一样.. 今天这个可以实现不同的类的序列化,但是注意的一点是我们发现前天的序列化类实现了模板 ..可以正常的序列化反序列化  如果我们将其抽象出来从一个基类派生,那么模板就显得不好处理了,这里最笨的方法使用到多重继承 实现多个基类...

C++通过操作内存模拟序列化---实现多种类型的序列化(2)
文章 2012-06-15 来自:开发者社区

以C++为例子,通过操作内存模拟实现对象的持久化存储(一)

原创作者:岳东卫转载请写明 半夜突然兴起,于是乎有敲起了代码(哎!明早上又要旷课了 。。。): 我们用到过很多的对象序列化的,我在保存数据 传输数据的时候经常用到..用的多了 就想考虑下 像MFC  以及 java  和 boost库中他们到底是如何来实现序列化的  。 最近我在thiking in java的时候,遇到了Scanner类的具体使用.这个类可以从一个实...

文章 2012-05-28 来自:开发者社区

C/C++版实现(Base64, UrlEncode等)

    【原创性声明】:本文无实质性创新性内容,性质属于技术总结,内容是基于已有知识或定义的代码实现。文中的代码是我根据其他代码或者网络上的资料,写出的自己的版本。因为网络上的代码 C/C++ 版本的较少,或者本身不一定是最合适最容易使用的。所以我写的代码基本是以 C 语言和 C 字符串处理为主的,因此它也可以直接在 C++ 的项目中使用。       (1)Base64 编码。Base...

文章 2012-04-23 来自:开发者社区

C++实现判断输入的数组是否是升序的程序

#include <iostream> #include <vector> using std::cout; using std::cin; using std::endl; using std::vector; //input elements for the vector class object v. void input(vector<int> &...

文章 2012-04-23 来自:开发者社区

C++实现的一个简单两个大数相加程序!

#include <iostream> using namespace std; #define ARRAY_SIZE 50 //Enter a big number, and store it as a string into an array ch, //the size is the numbers of char. void inputNumbers(char ch[], i....

文章 2012-04-17 来自:开发者社区

VC++游戏开发1------利用图片拼接实现内存中构建游戏地图,许多游戏编辑器的原理。

              此文章由yuedongwei521编写 ,转载请说明出处,本人现在正在学习 C++游戏开发有兴趣的 462264505@qq.com Q我一起交流.      源码我们放在下面供大家...

文章 2012-04-16 来自:开发者社区

C++实现用指针复制字符串

containerSlideBound.x + containerSlideBound.width) { //需要滑动 var scrollLeft = activeSlideBound.x - containerSlideBound.x container.scrollLeft = scrollLeft; } } //==========news end========== function go() { var elementById = document.getElementById("goToPage").value; if (elementById.length < 1 || elementById == undefined || elementById >50 || elementById == 0) { return; } else if (elementById > 1) { window.location.href = "//www.aliyun.com/sswb/channel_481394_" + elementById + ".html"; } else { window.location.href = "//www.aliyun.com/sswb/channel_481394.html"; } }; var h = document.getElementsByClassName("banner-content-top")[0].offsetHeight; var dots = document.querySelectorAll('.click-item'); var text = document.querySelectorAll('.text-box'); var btn = document.querySelectorAll('.ebook-info-item-btn'); var wrap = document.querySelector('.img-min'); var ebookbox = document.querySelectorAll('.img-box-ebook'); for (var i = 0; i < dots.length; i++) { (function (i) { dots[i].onclick = function () { for (var index = 0; index < dots.length; index++) { dots[index].className = 'click-item' text[index].className = 'text-box' btn[index].className = 'ebook-info-item-btn' ebookbox[index].className = 'img-box-ebook' } text[i].className = 'text-box show' btn[i].className = 'ebook-info-item-btn show' dots[i].className = 'click-item actives' ebookbox[i].className = 'img-box-ebook big' if(i == 0){ wrap.style.transform = "translate3d(15px, 0px, 0px)" } if(i == 1){ wrap.style.transform = "translate3d(-40px, 0px, 0px)" } if(i == 2){ wrap.style.transform = "translate3d(-100px, 0px, 0px)" } } })(i); } // 通过js控制当前选择 let selects = document.querySelectorAll('.select'); if(document.getElementsByClassName("detail-list-course")[0]){ var urlw = document.getElementsByClassName("detail-list-course")[0].offsetWidth; } let urlWidth = document.getElementsByClassName("course-url") // console.log(selects); // 找到图片组合 let images = document.querySelector(".course-info-box"); // 循环绑定点击事件 selects.forEach((slt,i) => { slt.addEventListener('click', (e) => { // 获取id let index = i; if(document.getElementsByClassName("course-info-item")[0]){ var w = document.getElementsByClassName("course-info-item")[0].offsetWidth; // 控制样式变化 let deg = w *i images.style.transform = `translate3d(-${deg}px, 0px, 0px)`; } // 找到原select对象、并移出样式 let slt_orgin = document.querySelector('.check'); if(slt_orgin){ slt_orgin.classList.remove('check'); // 当前select对象增加样式 slt.classList.add('check'); } urlWidth[i].style.width = urlw + 'px' }); }); window.onresize = function(){ images.style.transform = `translate3d(0px, 0px, 0px)`; // 找到原select对象、并移出样式 let slt_orgin = document.querySelector('.check'); if(slt_orgin){ slt_orgin.classList.remove('check'); // 当前select对象增加样式 selects[0].classList.add('check'); } urlWidth[0].style.width = urlw + 'px' } let num = 0 // 通过js控制当前选择 let recommendItem = document.querySelectorAll('.recommend-click-items') let texts = document.querySelectorAll('.recommend-list')[0] if(recommendItem){ // 循环绑定点击事件 recommendItem.forEach((slt,i) => { slt.addEventListener('click', (e) => { // 获取id let numbers = 0; if (i == 0){ numbers = 0 }else { numbers = 180 } if(texts){ texts.style.transform=`translate3d(0px, -${numbers}px, 0px)` } // 找到原select对象、并移出样式 let act_orgin = document.querySelector('.rmActives'); if(act_orgin){ act_orgin.classList.remove('rmActives'); // 当前select对象增加样式 slt.classList.add('rmActives'); } }); }); } let relatedSwiper = document.getElementsByClassName('related-course-pagination') let relatedItemLength = document.getElementsByClassName('related-course-itemBox').length if(relatedItemLength<=2){ if(relatedSwiper[0]){ relatedSwiper[0].innerHTML='\n \n' } } if(relatedItemLength>2&&relatedItemLength<=4){ relatedSwiper[0].innerHTML='\n \n \n ' } if(relatedItemLength>4&&relatedItemLength<=6){ relatedSwiper[0].innerHTML='\n \n \n \n ' } let reShowScm = document.querySelectorAll('.related-course-itemBox a') let reClickItem = document.querySelectorAll('.related-course-pagination .swiper-pagination-bullet') for (var i = 0; i < reClickItem.length; i++) { (function (i) { reClickItem[i].onclick = function () { console.log(i) for (var index = 0; index < reClickItem.length; index++) { reClickItem[index].className = 'swiper-pagination-bullet related-pagination-bullet' } reClickItem[i].className = 'swiper-pagination-bullet related-pagination-bullet swiper-pagination-bullet-active' if(i == 0){ document.querySelectorAll(".related-course-box")[0].style.transform = `translate3d(0px, 0px, 0px)` reShowScm.forEach((item,index)=>{ if(index<=2){ if(item.getAttribute('data-back-up')){ item.setAttribute('data-tracker-scm', item.getAttribute('data-back-up')) item.removeAttribute('data-back-up') } }else{ if(item.getAttribute('data-tracker-scm')) { item.setAttribute('data-back-up', item.getAttribute('data-tracker-scm')) item.removeAttribute('data-tracker-scm') } } }) } if(i == 1){ document.querySelectorAll(".related-course-box")[0].style.transform = `translate3d(0px, -190px, 0px)` reShowScm.forEach((item,index)=>{ if(index>2&&index<=4){ if(item.getAttribute('data-back-up')){ item.setAttribute('data-tracker-scm', item.getAttribute('data-back-up')) item.removeAttribute('data-back-up') } }else{ if(item.getAttribute('data-tracker-scm')) { item.setAttribute('data-back-up', item.getAttribute('data-tracker-scm')) item.removeAttribute('data-tracker-scm') } } }) } if(i == 2){ document.querySelectorAll(".related-course-box")[0].style.transform=`translate3d(0px, -380px, 0px)` reShowScm.forEach((item,index)=>{ if(index>4&&index<=6){ if(item.getAttribute('data-back-up')){ item.setAttribute('data-tracker-scm', item.getAttribute('data-back-up')) item.removeAttribute('data-back-up') } }else{ if(item.getAttribute('data-tracker-scm')) { item.setAttribute('data-back-up', item.getAttribute('data-tracker-scm')) item.removeAttribute('data-tracker-scm') } } }) } } })(i); } let ismore = document.querySelectorAll('.activity-card') if(ismore.length > 1){ ismore[1].style.display = "none" }