| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 660 人关注过本帖
标题:请帮忙菜鸟的我... 这个程式如何篇写...
只看楼主 加入收藏
KelvinTh9Great
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-11-30
收藏
 问题点数:0 回复次数:2 
请帮忙菜鸟的我... 这个程式如何篇写...
有哪位学长能告诉我C++如何让program A link去program B.
Example:
[1]: Encrytion Module
[2]: Decrytion Module
[3]: Exit the Program
Your Choice: (如果我选择1,然后link去Encryption Module, 以此推类)  


谢谢大家鼎立相救~P/S:能否告知了coding source后,在向我解释~
搜索更多相关主题的帖子: 程式 
2008-11-30 11:59
zhangyafei4353
Rank: 1
等 级:新手上路
帖 子:28
专家分:0
注 册:2008-11-28
收藏
得分:0 
改至别人的程序,仅供参考
你看看有用没:
#include<iostream.h>
#include<math.h>
class Date
{
    public:
        Date()//
        {
            year=0000;
            month=00;
            day=00;
        }
        Date(int year_input,int month_input,int day_input)//
        {
            year=year_input;
            month=month_input;
            day=day_input;
        }
        void date_set(int year_input,int month_input,int day_input)//
        {
            year=year_input;
            month=month_input;
            day=day_input;
        }
        void date_output()
        {
            cout<<year<<"--"<<month<<"--"<<day<<endl;
        }
        void date_plus()
        {
            if(day+1<=get_days(month,year))
                day++;
            else
            {
                month_plus();
                day=1;
            }
        }
        void date_down()
        {
            if(day-1>=1)
                day--;
            else
            {
                month_down();
                day=get_days(month,year);
            }
        }
        void month_plus()
        {
            if(month+1<=12)
                month++;
            else
            {
                year++;
                month=1;
            }

        }
        void month_down()
        {
            if(month-1>=1)
                month--;
            else
            {
                year--;
                month=12;
            }
        }
        int days_calculate(int year_input,int month_input,int day_input)//计算两个日期间的天数
        {
            int total_days=0;
            int leapyears;
            int i;
            if(year_input==year)
            {
                for(i=1;i<month;i++)
                    total_days+=get_days(i,year);
                total_days+=day;
                for(i=1;i<month_input;i++)
                    total_days-=get_days(i,year_input);
                total_days-=day_input;
                return abs(total_days);
            }
            else if(year_input<year)
            {
                leapyears=0;
                for(i=year_input;i<year;i++)
                    if(is_leap(i))
                        leapyears++;
                total_days=(year-year_input)*365+leapyears;

                for(i=1;i<month;i++)
                    total_days+=get_days(i,year);
                total_days+=day;
                for(i=1;i<month_input;i++)
                    total_days-=get_days(i,year_input);
                total_days-=day_input;
                return abs(total_days);
            }
            else
            {
                leapyears=0;
                for(i=year;i<year_input;i++)
                    if(is_leap(i))
                        leapyears++;
                total_days=(year_input-year)*365+leapyears;

                for(i=1;i<month_input;i++)
                    total_days+=get_days(i,year_input);
                total_days+=day_input;
                for(i=1;i<month;i++)
                    total_days-=get_days(i,year);
                total_days-=day;
                return abs(total_days);
            }
        }
    private:
        int get_days(int month_,int year_)
        {
            switch(month_)
            {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    return 31;
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    return 30;
                    break;
                case 2:
                    if(is_leap(year_))
                        return 29;
                    else
                        return 28;
                    break;
                default:
                    return 0;
            }
        }
        bool is_leap(int year_)
        {
            if(year_%4)
                return false;
            else if(year_%100)
                return true;
            else if(year_%400)
                return false;
            return true;
        }
    private:
        int year,month,day;
};
void main()
{
    int m_year,m_month,m_Day,result;
    char m_choice;
    Date date(2008,11,26);
    cout<<"    1.日期的设置'S';2.日期的显示'X';3.日期加一天'A';\n    4.日期减一天'J';5.日期算间隔'G';6.退出'Q';\n\n\n"<<endl;
    while(m_choice!='Q')
    {
        cout<<"请选择:"; cin>>m_choice;
        switch(m_choice)
        {
            case 'S':    cout<<"Y:"; cin>>m_year;
                        cout<<"M:"; cin>>m_month;
                        cout<<"D:"; cin>>m_Day;
                        date.date_set(m_year,m_month,m_Day);
                        break;
            case 'X':    break;
            case 'A':    date.date_plus();                
                        break;    
            case 'J':    date.date_down();                
                        break;
            case 'G':    cout<<"    目前时间:\n\n"<<endl;                
                        date.date_output();
                        cout<<"Y:"; cin>>m_year;
                        cout<<"M:"; cin>>m_month;
                        cout<<"D:"; cin>>m_Day;
                        result=date.days_calculate(m_year,m_month,m_Day);
                        cout<<"    间隔时间:"<<result<<endl;
                        break;                        
        }
        if(m_choice!='G')  date.date_output();
    }
}
2008-11-30 20:26
p1s
Rank: 4
等 级:贵宾
威 望:10
帖 子:454
专家分:3
注 册:2005-11-4
收藏
得分:0 
LZ这个问题很模糊。模块要模块到什么程度呢?是自己编写的函数?别人编写好的源代码?还是已经编译好的DLL?这都可能是不同的方法啊。
2008-11-30 21:54
快速回复:请帮忙菜鸟的我... 这个程式如何篇写...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018494 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved