我得到了这样的作业:
我将有一个用户输入日期的选择屏幕输入框和一个他输入月份的另一个输入框.
我要做的是添加给定的月份数并获得新的日期.
示例:如果输入的日期是2/3/2011,5我应该得到给定的月数7/3/2011.
我知道系统日期变量'SY-DATUM'有应用服务器日期.并且做日期操作我可以说SY-DATUM + 2.i只能添加天数,我应该如何添加月份.
请给我一个良好的开端.谢谢.
我一直在互联网上搜索如何获得programaticaly谷歌加一键计数.最后我发现这篇文章 这里是arcticle中提到的Php脚本.
<?php
$url = "http://www.tomanthony.co.uk/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '[{"method":"pos.plusones.get","id":"p","params":{"nolog":true,"id":"' . $url . '","source":"widget","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
$curl_results = curl_exec ($ch);
curl_close ($ch);
$parsed_results = json_decode($curl_results, true);
echo $parsed_results[0]['result']['metadata']['globalCounts']['count'];
?>
Run Code Online (Sandbox Code Playgroud)
我尝试了一切,我已经坐了3个小时,但可以让它工作.但它似乎对他非常好.它是完全直接和简单的脚本.
我甚至使用firebug来检查请求.我尝试用找到的一个替换post数据值.
[{"method":"pos.plusones.get","id":"pos.plusones.get","params":{"cdx":"cb4","id":"http://www.tomanthony.co.uk/google_plus_one_api_example.php","source":"widget","container":"http://www.tomanthony.co.uk/google_plus_one_api_example.php","userId":"@viewer","groupId":"@self"},"jsonrpc":"2.0","key":"pos.plusones.get","apiVersion":"v1"}]
Run Code Online (Sandbox Code Playgroud)
我不知道我哪里错了.它只是一个简单的代码.
我有以下单个链表,我总是得到1的长度,即使我推3个元素,并且始终只创建一个节点.请帮助.谢谢.
#include <stdio.h>
struct node
{
int data;
struct node *next;
};
void push(struct node **head,int data)
{
struct node *temp = (struct node*)malloc(sizeof(struct node));
temp->data=data;
if(*head == NULL)
{
*head=temp;
}
else
{
temp->next=*head;
*head=temp;
}
}
int length(struct node *head)
{
struct node *temp = head;
int count=0;
if(temp !=NULL)
{
count++;
printf("%d",temp->data);
temp=temp->next;
}
return count;
}
int main()
{
int a;
struct node *head=NULL;
push(&head,1);
push(&head,2);
push(&head,3);
a=length(head);
printf("%d",a);
return 0;
}
Run Code Online (Sandbox Code Playgroud)