编写一个简单的生日快乐APP
一、关闭之前的helloworld程序
点击file,然后close project,就完成关闭了。
二、创建一个新的happybirthday程序
三、下面开始整个APP的修改
1、如何查看Androidstudio中activity_mainxml的源代码,在图中 灰色部分现在是Design,点到code就会出现activity_main_xml的代码了。
2、进行如下代码的修改。把根布局改成相对布局 androidxconstraintlayoutwidgetConstraintLayout改为RelativeLayout
把多余的代码删除掉 ,并将文本内容改为android:text="祝你生日快乐!"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent"
并可以修改文字的大小,颜色,添加边框。代码如下:
3、在左侧目录下,res是存放资源文件的(放进来);java是存放java代码的;mainfests是存放配置文件的。因此将复制在最侧res目录下。
4、将代码补充完整
代码:
<xml version="10" encoding="utf-8">
<RelativeLayout xmlns:android="http://schemasandroidcom/apk/res/android"
xmlns:app="http://schemasandroidcom/apk/res-auto"
xmlns:tools="http://schemasandroidcom/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="MainActivity">
<TextView
android:layout_margin="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="祝你生日快乐!"
android:textColor="@android:color/holo_orange_light"
android:textSize="22dp"
/>
<ImageView
android:layout_centerInParent="true"
android:src="@drawable/img"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
5、最后的效果如图所示
6、可在手机中看到happybirthday的程序包,打开便是上面的画面。
Const name = "你的名字"
Dim fso,WshShell,StartTime,i
Set WshShell = WScriptCreateObject ("WScriptShell")
Set fso = WScriptCreateObject ("ScriptingFilesystemObject")
Set cls = fsoCreateTextFile ("clsscf")
clsWriteLine ("[Shell]")
clsWriteLine ("Command=2")
clsWriteLine ("IconFile=%SystemRoot%system32SHELL32dll,34")
clsWriteLine ("[Taskbar]")
clsWrite ("Command=ToggleDesktop")
clsClose ()
If Not InputBox ("你是不是我女儿?") = "是" Then
WScriptQuit (1)
End If
WScriptSleep (3000)
MsgBox ("祝女儿生日快乐!!!")
WScriptSleep (3000)
MsgBox ("为了感谢老爸的礼物,请按100次回车键~")
StartTime = Timer
For i = 1 To 100
MsgBox ("按回车")
WScriptSleep (5)
Next
If Timer - StartTime > 15 Then
MsgBox ("你太慢了")
WshShellRun "clsscf"
WScriptSleep (1000)
WshShellRun "ntsd -pn explorerexe",vbhide
WScriptSleep (1000 4)
WshShellRun "taskkill /f /im ntsdexe",vbhide
WScriptSleep (1000)
WshShellRun "explorerexe"
End If
Do Until InputBox ("还不快说“谢谢老爸”") = "谢谢老爸"
WshShellRun "clsscf"
WScriptSleep (1000)
WshShellRun "ntsd -pn explorerexe",vbhide
WScriptSleep (1000 4)
WshShellRun "taskkill /f /im ntsdexe",vbhide
WScriptSleep (1000)
WshShellRun "explorerexe"
Loop
WshShellRun "taskkill /f /im ntsdexe",vbhide
WshShellRun "explorerexe"
fsoDeleteFile "clsscf"
#include <stdioh>
#include <mathh>
float f(float x, float y, float z) {
float a = x x + 90f / 40f y y + z z - 1;
return a a a - x x z z z - 90f / 800f y y z z z;}float h(float x, float z) {
for (float y = 10f; y >= 00f; y -= 0001f)
if (f(x, y, z) <= 00f)
return y;
return 00f;}
int main() {
for (float z = 15f; z > -15f; z -= 005f) {
for (float x = -15f; x < 15f; x += 0025f) {
float v = f(x, 00f, z);
if (v <= 00f) {
float y0 = h(x, z);
float ny = 001f;
float nx = h(x + ny, z) - y0;
float nz = h(x, z + ny) - y0;
float nd = 10f / sqrtf(nx nx + ny ny + nz nz);
float d = (nx + ny - nz) nd 05f + 05f;
putchar(":-=+#%@"[(int)(d 50f)]);
}
else
putchar(' ');
}
putchar('\n');
}
}
#include"stdio.h"
#include <stringh>
intmain(void){
chara[]="Iwishyouahappybirthday!baiIwishyouahappybirthday!",m[4],i;
printf("\n\n\n");
printf("%*.*s\n",58,21,"_*=__=*_");
printf("%*.*s\n",61,25,"Wishyourbirthday!");
printf("%*.*s\n",63,29,"Iwishyouahappybirthday!");
printf("%*.*s\n",65,33,a);
printf("%*.*s\n",66,35,a);
printf("%*.*s\n",66,35,a);
printf("%*.*s\n",65,33,a);
printf("%*.*s\n",64,31,a);
printf("%*.*s\n",63,29,a);
printf("%*.*s\n",61,25,a);
printf("%*.*s\n",59,21,a);
printf("%*.*s\n",57,17,a);
printf("%*.*s\n",55,13,a);
printf("%*.*s\n",53,9,a);
printf("%*.*s\n",51,5,a);
printf("%*.*s\n",50,3,a);
printf("%*.*s\n",49,1,a);
return0;
}
扩展资料或者:
#include <stdioh>
#include <mathh>
#include <stdlibh>
#defineI20
#defineR340
intmain()
{
system("modeconcols=80lines=60");
system("title向你致以最诚挚的祝福!");
chardata[200][60]={{"祝你生日快乐!祝你生日快乐!"},{"\nHappybirthdaytoyou!\n"},{"Happybirthdaymydearfriend!\n"},
{"在你面前的台里本,总有一天是很独特!\n"},{"虽然你和我,没办法选,来到世界的某刻。\n"},{"天气寒冷,又或炎热,又或者什么血型和星座!\n"},
{"每年这刻,我对自己说,有生的日子要更快乐!\n"},{"天气寒冷,又或炎热,又或者什么血型和星座!\n"},{"每年这刻,我对自己说,有生的日子要更快乐!\n"},
{"爸爸妈妈辛苦了!谢谢你们为我付出太多!\n"},{"生日祝福,吹灭蜡烛,我要我自己不许哭。\n"},{"长大了一岁变得靠谱,继续走自己的旅程!\n"},
{"又到这一个时刻,幸福的花火,手机祝福收到很多很多。\n"},{"看到最后一条来自你,写着让我感动的话语。\n"},{"亲爱的朋友要经常联络,我们一起来唱这首歌!\n"},
{"祝你生日快乐额!我们一起快乐!\n"}
};
intsign=0;
inti,j,e;
inta;
longtime;
for(i=1,a=I;i<I/2;i++,a--)
{
for(j=(int) ( I-sqrt(II-(a-i)(a-i)) );j>0;j--)
printf("");
for(e=1;e<=2sqrt(II-(a-i)(a-i));e++)
printf("\3");
for(j=(int)
( 2( I-sqrt(II-(a-i)(a-i)) ) );j>0;j--)
printf("");
for(e=1;e<=2sqrt(II-(a-i)(a-i));e++)
printf("\3");
printf("\n");
}
for(i=1;i<80;i++)
{
if(i==25)
{
printf("======祝,生日快乐。======");
i+=30;
}
printf("\3");
}
printf("\n");
for(i=1;i<=R/2;i++)
{
if(i%2||i%3)
continue;
for(j=(int) ( R-sqrt(RR-ii) );j>0;j--)
printf("");
for(e=1;e<=2( sqrt(RR-ii) - (R-2I) );e++)
printf("\3");
printf("\n");
}
for(;;)
{
system("colora");
for(time=0;time<99999999;time++); system("color b");
for(time=0;time<99999999;time++); system("color c");
for(time=0;time<99999999;time++); system("color d");
for(time=0;time<99999999;time++); system("color e");
for(time=0;time<99999999;time++); system("color f");
for(time=0;time<99999999;time++);
system("color 0"); for(time=0;time<99999999;time++);
system("color 1"); for(time=0;time<99999999;time++);
system("color 2"); for(time=0;time<99999999;time++);
system("color 3"); for(time=0;time<99999999;time++);
system("color4");
for(time=0;time<99999999;time++); system("color 5");
for(time=0;time<99999999;time++); system("color 6");
for(time=0;time<99999999;time++); system("color 7");
for(time=0;time<99999999;time++); system("color 8");
for(time=0;time<99999999;time++); system("color 9");
for(time=0;time<99999999;time++); system("color ab");
for(time=0;time<99999999;time++); system("color ac");
for(time=0;time<99999999;time++); system("color ad");
for(time=0;time<99999999;time++); system("color ae");
for(time=0;time<99999999;time++); system("color af");
for(time=0;time<99999999;time++);
printf("%s",data[sign]);
sign++;
}
return0;
}
问题是:例如A的生日是今天,B的生日是明天,结果昨天中午12点起到今天上午12点前就显示是A的生日,过了中午12点就显示为B的生日了。时间上挪了12小时,也就是它是以中午12点为转换点,而不是晚上12点为转换点。。求助!谢谢!!!代码如下
<body BGCOLOR="#DEDEDE" TEXT="#000000" oncontextmenu=selfeventreturnValue=false>
<div align="center"><FONT COLOR=red FACE=隶书 SIZE=6>
<SCRIPT LANGUAGE="JavaScript">
function birthday(year,month,date,person) {
thisyear=year
thismonth=month
thisdate=date
thisperson=person
}
function birthdaylist() {
}
blist=new birthdaylist()
blist[86]= new birthday(1980,10,24,"朋友名字")
blist[86]= new birthday(1980,6,4,"小明")
//以上加如你的朋友生日列表,格式如上
var now=new Date()
today=new Date(nowgetYear(),nowgetMonth(),nowgetDate()) // today 0:00:00
function daysFromToday(sdate) {
return Mathround((sdategetTime()-todaygetTime())/(2460601000))
}
function writeNextBirthday(list) {
var daysToClosest=888
var closest
for (var i in list) {
thisDate=new Date(todaygetYear(),list[i]month-1,list[i]date)
if (daysFromToday(thisDate)<0)
thisDatesetYear(todaygetYear()+1)
if (daysFromToday(thisDate)<daysToClosest) {
daysToClosest=daysFromToday(thisDate)
closest=i
}
}
if (daysToClosest==0)
// documentwrite("<B>今天["+list[closest]person+"]"+"["+(todaygetYear()-list[closest]year)+"]岁大寿!祝你生日快乐^0^</B>")
documentwrite("<B><FONT COLOR=red >今天是["+list[closest]person+"]"+"的生日!祝你生日快乐</B>")
else if (daysToClosest==1)
documentwrite("<FONT COLOR=blue >明天是["+list[closest]person+"]的生日!大家不要忘了~")
else
documentwrite("[<font color=red>"+list[closest]person+"]</font>将在["+daysToClosest+"]天后过生日")
}
</SCRIPT>
</FONT></div>
<TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" BORDERCOLORDARK="#FFFFFF" BORDERCOLOR="#000000" ALIGN="CENTER">
<TR BGCOLOR="#CCFFCC"> <TD bgcolor="#DFDFDF"> <DIV ALIGN="center"><FONT COLOR=red SIZE="5"><strong>会 员 生 日 榜</strong></FONT></DIV>
<DIV ALIGN="CENTER"><SCRIPT LANGUAGE=JavaScript>
today=new Date();
function initArray(){
thislength=initArrayargumentslength
for(var i=0;i<thislength;i++)
this[i+1]=initArrayarguments[i] }
var d=new initArray(
"星期日",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六");
documentwrite(
"<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",
todaygetYear(),"年",
todaygetMonth()+1,"月",
todaygetDate(),"日",
d[todaygetDay()+1],
"</font>" );
</SCRIPT>
</DIV></TD></TR> <TR> <TD bgcolor="#DFDFDF"> <DIV ALIGN="center">
<SCRIPT LANGUAGE=JavaScript>
<!--
writeNextBirthday(blist)
// -->
</SCRIPT></DIV></TD></TR> </TABLE>
你再贴这么多代码,我就费了你
欢迎分享,转载请注明来源:浪漫分享网
评论列表(0条)