Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
W

wbgxx

@wbgxx
About
Posts
38
Topics
16
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C++ Programming
    W wbgxx

    g++ vim

    Linux, Apache, MySQL, PHP question c++ linux

  • find a effictive way!!
    W wbgxx

    could you give me detail??Thanks

    C / C++ / MFC algorithms tutorial

  • find a effictive way!!
    W wbgxx

    for example there is a four bits integer 1122, if someone guess and inout 1234, because 1 and 2 are in 1122, and the position is same, the computer will tell you that you are right with two numbers and they are 1 and 2; as follows is my program, I thinnk they are too complex , could some tell me a simple algorithm, thinks in advantage #include <stdio.h> #include <stdlib.h> int main() { int data1 = 1234; int data2; int gewei1, shiwei1, baiwei1, qianwei1; int gewei2, shiwei2, baiwei2, qianwei2; int count = 0; gewei1 = data1%10; shiwei1 = (data1%100)/10; baiwei1 = (data1%1000)/100; qianwei1 = data1 /1000; int arr1[4] = {qianwei1, baiwei1, shiwei1, gewei1}; printf("Please Enter a interger:"); scanf("%d", &data2); gewei2 = data2%10; shiwei2 = (data2%100)/10; baiwei2 = (data2%1000)/100; qianwei2 = data2 /1000; int arr2[4] = {qianwei2, baiwei2, shiwei2, gewei2}; for (int i=0; i<4; i++) { if(arr1[i] == arr2[i]) { printf("%d ", arr1[i]); count++; } else continue; } printf("the same number is %d ", count); return 0; }

    C / C++ / MFC algorithms tutorial

  • why segmentation fault !
    W wbgxx

    wonderful! I see, thanks in advance!

    C / C++ / MFC

  • why segmentation fault !
    W wbgxx

    thanks ! but I still have question why this can be run

    #include <iostream.h>
    #include <cstring>
    void swap(char *,char *);
    int main()
    {char str1[20]="hello",str2[20]="how are you ";
    char pt[20];
    cout<<"str1"<<" "<<str1<<endl;
    cout<<"str2"<<" "<<str2<<endl;
    strcpy(pt,str1);
    strcpy(str1,str2);
    strcpy(str2,pt);
    cout<<"str1"<<" "<<str1<<endl;
    cout<<"str2"<<" "<<str2<<endl;
    return 0;
    }

    C / C++ / MFC

  • hex calculator
    W wbgxx

    In my opinion Google is a good way to study!

    Algorithms question

  • why segmentation fault !
    W wbgxx

    I want to swap two string

    #include <stdio.h>
    #include <string.h>
    void swap(char *a1, char *a2)
    {
    char ch[20];
    if (a1 != NULL || a2 != NULL)
    {
    strcpy(ch, a1);
    strcpy(a1, a2);
    strcpy(a2, ch);

    	}
    else
    	return ;
    

    }

    int main()
    {
    char *a1 = "hello";
    char *a2 = "world";
    printf("Before the swap a1=%s, a2=%s", a1, a2);
    swap(a1, a2);
    printf("After the swap a1=%s, a2=%s", a1, a2);
    return 0;
    }

    C / C++ / MFC

  • Difference between VC6 and VS 2008.
    W wbgxx

    I think there is not many differents ,I now in China and many company still use vs6

    C / C++ / MFC visual-studio design question

  • Learning Linux
    W wbgxx

    I think the first to do install a linux OS

    Linux, Apache, MySQL, PHP linux question learning

  • Can someone give a detail of this sample coder why the result is 9,and not 4??
    W wbgxx

    #include <iostream.h>
    int main()
    {
    int x=1,y;
    y= ++x*++x;
    cout << x << endl;
    cout << y <<endl;
    return 0;
    }

    C / C++ / MFC question

  • Can someone give a detail of " shortest-seek -time-First algorithm" some coder is the better
    W wbgxx

    RT

    Algorithms algorithms

  • could some one give me a detail of this the result??I don not know why,more detail more better
    W wbgxx

    cout << (unsigned int)(&struct2.struct1) - (unsigned int)(&struct2)
    << endl;

    and what is (unsigned int)(&struct2.struct1)means?

    C / C++ / MFC question

  • a question of struct copys
    W wbgxx

    #include <iostream.h>

    struct structA
    {
    int iMember;
    char *cMember;
    };

    int main(int argc, char* argv[])

    {
    structA instant1,instant2;

    char c = 'a';

    instant1.iMember = 1;
    instant1.cMember = &c;
    instant2 = instant1;

    cout << *(instant1.cMember) << endl;
    *(instant2.cMember) = 'b';
    cout << *(instant1.cMember) << endl; //I want to know why change instant2 and the instant1 change!

    getchar();
    }

    C / C++ / MFC question

  • could some one give me a detail of this the result??I don not know why,more detail more better
    W wbgxx

    #include <iostream>
    using namespace std;
    #pragma pack(8)

    struct example1
    {
    short a;
    long b;
    };

    struct example2
    {
    char c;
    example1 struct1;
    short e;
    };

    #pragma pack()

    int main()
    {
    example2 struct2;
    cout << sizeof(example1) << endl; //8
    cout << sizeof(example2) << endl; //16
    cout << (unsigned int)(&struct2.struct1) - (unsigned int)(&struct2)
    << endl; //4

       getchar();
    

    }

    C / C++ / MFC question

  • My progremmer can't run,why??
    W wbgxx

    sorry ,I don't know why

    C / C++ / MFC question

  • My progremmer can't run,why??
    W wbgxx

    #include <iostream>
    #include <string>
    using namespace std;

    class CBuffer
    {
    char * m_pBuffer;
    int m_size;
    public:
    CBuffer()
    {
    m_pBuffer=NULL; }
    ~CBuffer()
    {
    Free();
    }
    void Allocte(int size) (3) {
    m_size=size;
    m_pBuffer= new char[size];
    }
    private:
    void Free()
    {
    if(m_pBuffer!=NULL)
    {
    delete m_pBuffer;
    m_pBuffer=NULL;
    }
    }
    public:
    void SaveString(const char* pText) const
    {
    strcpy(m_pBuffer, pText);
    }
    char* GetBuffer() const
    {
    return m_pBuffer;
    }
    };

    int main ()
    {
    CBuffer buffer1;
    buffer1.SaveString("Microsoft");
    printf("%s", buffer1.GetBuffer());
    return 0;
    }

    C / C++ / MFC question

  • my strcpy funcution!
    W wbgxx

    sorry,I can not test it ,can you tell me how to do it ?

    C / C++ / MFC question

  • my strcpy funcution!
    W wbgxx

    char *my_strcpy(char *p1, char *p2)
    {
    if (p2 == NULL )
    return p1;
    if (p1 == NULL)
    return 0;
    else
    {

    		char \*pp1 = p1;
    		char \*pp2 = p2;
    		while (p2 != '\\0')
    		{
    			\*p1++ = \*p2++;
    		}
    		\*pp1 = '\\0';
    	}
    	
    	return p1;
    

    }

    C / C++ / MFC question

  • my strcpy funcution!
    W wbgxx

    char *my_strcpy(char *p1, char *p2) { if (p2 == NULL ) return p1; if (p1 == NULL) return 0; else { char *pp1 = p1; char *pp2 = p2; while (p2 != '\0') { *p1++ = *p2++; } *pp1 = '\0'; } return p1; } Is there something wrong in my function and why? Thanks in advantage

    C / C++ / MFC question

  • find a sulution!
    W wbgxx

    Yeah,thanks

    Algorithms lounge
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups