码迷,mamicode.com
首页 > 编程语言 > 详细

C++编写谷歌日历

时间:2018-10-28 20:45:04      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:大学英语   大学   stat   seq   close   else   zone   cat   namespace   

#include<iostream>
#include<fstream>
using namespace std;
void main() //程序从这里开始运行
{
    int day;

    ofstream fout("D:\jixingkebiao.ics");

    //基本内容输入
    fout << "BEGIN:VCALENDAR" << endl;
    fout << "PRODID:-//Google Inc//Google Calendar 70.9054//EN" << endl;
    fout << "VERSION:2.0" << endl;
    fout << "CALSCALE:GREGORIAN" << endl;
    fout << "METHOD:PUBLISH" << endl;
    fout << "X-WR-CALNAME:课程表" << endl;
    fout << "X-WR-TIMEZONE:Asia/Shanghai" << endl;

    //输入英语课表
    for (int t = 0; t < 2; t++)
    {
        day = 5;
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {

            fout << "DTSTART:2018030" << day << "T000000Z" << endl;
            fout << "DTEND:2018030" << day << "T013500Z" << endl;
            fout << "LOCATION:北综楼 111/胡冬梅" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180604T155959Z" << endl;
        }
        else
        {
            fout << "DTSTART:2018030" << day + 3 << "T020500Z" << endl;
            fout << "DTEND:2018030" << day + 3 << "T034000Z" << endl;
            fout << "LOCATION:北综楼 111/胡冬梅" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180607T155959Z" << endl;
        }

        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:大学英语" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }
    //输入数字逻辑课表
    for (int t = 0; t < 2; t++)
    {
        day = 5;
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {

            fout << "DTSTART:2018030" << day << "T020500Z" << endl;
            fout << "DTEND:2018030" << day << "T034000Z" << endl;
            fout << "LOCATION:综合楼303/墙威" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180507T155959Z" << endl;
        }
        else {

            fout << "DTSTART:2018030" << day + 2 << "T060000Z" << endl;
            fout << "DTEND:2018030" << day + 2 << "T073500Z" << endl;
            fout << "LOCATION:综合楼408/墙威" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180509T155959Z" << endl;

        }

        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:数字逻辑" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }
    //输入高等数学课表
    day = 5;

    for (int t = 0; t < 3; t++)
    {
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {


            fout << "DTSTART:2018030" << day << "T060000Z" << endl;
            fout << "DTEND:2018030" << day << "T073500Z" << endl;
            fout << "LOCATION:综合楼303/李少华" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180702T155959Z" << endl;
        }
        else if (t == 1)
        {
            fout << "DTSTART:2018030" << day + 2 << "T000000Z" << endl;
            fout << "DTEND:2018030" << day + 2 << "T013500Z" << endl;
            fout << "LOCATION:综合楼304/李少华" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180704T155959Z" << endl;
        }
        else if (t == 2)
        {
            fout << "DTSTART:2018030" << day + 4 << "T060000Z" << endl;
            fout << "DTEND:2018030" << day + 4 << "T073500Z" << endl;
            fout << "LOCATION:综合楼207/李少华" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180706T155959Z" << endl;
        }
        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:高等数学" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }
    //输入电工与电子技术课表

    day = 6;

    for (int t = 0; t < 2; t++)
    {
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {

            fout << "DTSTART:2018030" << day << "T000000Z" << endl;
            fout << "DTEND:2018030" << day << "T013500Z" << endl;
            fout << "LOCATION:综合楼307/胡志敏" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180508T155959Z" << endl;
        }
        else
        {

            fout << "DTSTART:2018030" << day + 2 << "T000000Z" << endl;
            fout << "DTEND:2018030" << day + 2 << "T013500Z" << endl;
            fout << "LOCATION:综合楼111/胡志敏" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180510T155959Z" << endl;

        }

        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:电工与电子技术" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }

    //输入离散数学课表

    day = 3;

    for (int t = 0; t < 2; t++)
    {
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {
            fout << "DTSTART:2018040" << day << "T060000Z" << endl;
            fout << "DTEND:2018040" << day << "T073500Z" << endl;
            fout << "LOCATION:教一楼503/吴亦奇" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180703T155959Z" << endl;
        }
        else
        {
            fout << "DTSTART:2018040" << day + 3 << "T000000Z" << endl;
            fout << "DTEND:2018040" << day + 3 << "T013500Z" << endl;
            fout << "DESCRIPTION:" << endl;
            fout << "LOCATION:教一楼404/吴亦奇" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180706T155959Z" << endl;

        }
        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:离散数学" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }
    //输入地球科学概论课表

    day = 6;

    for (int t = 0; t < 2; t++)
    {
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {

            fout << "DTSTART:2018030" << day << "T110000Z" << endl;
            fout << "DTEND:2018030" << day << "T123500Z" << endl;
            fout << "LOCATION:综合楼410/任利民" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180424T155959Z" << endl;
        }
        else
        {
            fout << "DTSTART:2018030" << day + 2 << "T110000Z" << endl;
            fout << "DTEND:2018030" << day + 2 << "T123500Z" << endl;
            fout << "LOCATION:综合楼106/任利民" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180426T155959Z" << endl;
        }

        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:地球科学概论" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }
    //输入体育课课表

    day = 7;

    fout << "BEGIN:VEVENT" << endl;

    fout << "DTSTART:2018030" << day << "T020500Z" << endl;
    fout << "DTEND:2018030" << day << "T034000Z" << endl;
    fout << "RRULE:FREQ=WEEKLY;UNTIL=20180704T155959Z" << endl;
    fout << "LOCATION:北区体育馆/袁春梅" << endl;
    fout << "DESCRIPTION:" << endl;
    fout << "SEQUENCE:0" << endl;
    fout << "STATUS:CONFIRMED" << endl;
    fout << "SUMMARY:乒乓球初级班" << endl;
    fout << "TRANSP:OPAQUE" << endl;
    fout << "END:VEVENT" << endl;
    
    

    //输入高级软件编程技术课表

    day = 16;
    for (int t = 0; t < 2; t++)
    {
        fout << "BEGIN:VEVENT" << endl;
        if (t == 0) {


            fout << "DTSTART:201805" << day << "T060000Z" << endl;
            fout << "DTEND:201805" << day << "T073500Z" << endl;
            fout << "LOCATION:教一楼408/熊慕舟" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180627T155959Z" << endl;
        }
        else
        {
            fout << "DTSTART:201805" << day + 2 << "T020500Z" << endl;
            fout << "DTEND:201805" << day + 2 << "T034000Z" << endl;
            fout << "LOCATION:教一楼408/熊慕舟" << endl;
            fout << "RRULE:FREQ=WEEKLY;UNTIL=20180627T155959Z" << endl;
        }
        fout << "DESCRIPTION:" << endl;
        fout << "SEQUENCE:0" << endl;
        fout << "STATUS:CONFIRMED" << endl;
        fout << "SUMMARY:高级软件编程技术" << endl;
        fout << "TRANSP:OPAQUE" << endl;
        fout << "END:VEVENT" << endl;
    }

    fout << "END:VCALENDAR";
    fout.close();

    return;


}

 

C++编写谷歌日历

标签:大学英语   大学   stat   seq   close   else   zone   cat   namespace   

原文地址:https://www.cnblogs.com/Stephen-Jixing/p/9866700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!