C习生
发表于 2015-1-28 00:13:11
热烈庆祝鱼C五周年嘉年华!
qdwushuming
发表于 2015-1-28 08:31:02
回帖挣鱼币
wuyixin
发表于 2015-1-28 10:28:52
我来试一下
欣若止水
发表于 2015-1-28 10:36:12
我也来xuexile
1099062139
发表于 2015-1-28 12:59:03
我来啦
984563340
发表于 2015-1-29 21:53:07
好久没有来了今天来玩玩
lixiaoshuai
发表于 2015-1-29 22:35:19
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout<<"*****"<<setw(5)<<"**"<<setw(7)<<"***"<<setw(5)<<"*"<<setw(14)<<"*****"<<endl;
cout<<"*"<<setw(13)<<"*"<<setw(8)<<"*"<<setw(9)<<"*"<<endl;
cout<<"*****"<<setw(5)<<"**"<<setw(5)<<"*"<<setw(11)<<"*****"<<setw(5)<<"*"<<endl;
cout<<"*"<<setw(9)<<"**"<<setw(9)<<"*"<<setw(3)<<"*"<<setw(4)<<"*"<<setw(5)<<"*"<<endl;
cout<<"*"<<setw(9)<<"**"<<setw(6)<<"***"<<setw(6)<<"*"<<setw(4)<<"*"<<setw(10)<<"*****"<<endl;
return 0;
}
lixiaoshuai
发表于 2015-1-29 22:46:41
刚刚恢复的特辣,其中用到想用这个功能:cout<<setfill(‘#’)<<123<<endl;
发现显示是:有点诧异,有人可以解答吗?
顺便问问当用到在编程时经常会中英文切换,而有时用着中文来编写符号了,到运行时才发现错误,有人有什么技巧可以解决吗?总不能时不时盯着输入法吧。。。 这个问题如果不该在这个版块提问,烦请告之哪个版块?谢谢^^
康小泡
发表于 2015-1-30 19:45:20
xwmllbd 发表于 2015-1-27 17:03
到哪天结束啊
今天第一轮结束 每个星期回更新一次最后要到2.23号才最终结束
xwmllbd
发表于 2015-1-30 19:48:29
知道了,谢谢啊!!!
wec246810
发表于 2015-2-4 17:11:28
只能支持一下了。。
wec246810
发表于 2015-2-4 17:54:33
特辣小菜#include <stdio.h>
#include<windows.h>
int main()
{ while(1){
printf("***** ** * * * * *****\n");Sleep(200);
printf("* * * *\n");Sleep(200);
printf("***** ** * ** ****** *\n");Sleep(200);
printf("* ** * * * *\n");Sleep(200);
printf("* ** * * * * * *****\n");Sleep(200);
system("cls");Sleep(200);
}
return 0;
}
freeparty
发表于 2015-2-4 18:45:21
领鱼币
635178917
发表于 2015-2-5 14:57:04
对啊,看帖回帖,不知不觉就升级了
wec246810
发表于 2015-2-6 15:49:01
#include <stdio.h>
#include<windows.h>
int main()
{ while(1){
printf("***** ** * * * * *****\n");Sleep(200);
printf("* * * *\n");Sleep(200);
printf("***** ** * ** ****** *\n");Sleep(200);
printf("* ** * * * *\n");Sleep(200);
printf("* ** * * * * * *****\n");Sleep(200);
system("cls");Sleep(200);
}
return 0;
}特辣小菜。。
mhhnjuol
发表于 2015-2-7 14:42:35
看看大神的代码,让新人学习一下
_DEBUG
发表于 2015-2-10 23:01:32
来晚了,直接上特辣吧,尽管还有很多可改进的地方
http://bbs.fishc.com/data/attachment/album/201502/10/225855p7pvpopt7pedp5t9.gif
_DEBUG
发表于 2015-2-10 23:02:31
本帖最后由 _DEBUG 于 2015-2-10 23:06 编辑
#include <Windows.h>
#include <math.h>
#include <time.h>
#ifndef _countof
#define _countof(a) (sizeof(a)/sizeof(a))
#endif
HRESULT CALLBACK WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam);
void DrawStar(HDC hdc,int cx,int cy);
void DrawCharS(HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness);
void DrawCharHalfS(HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness);
void DrawStringFishc(HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness);
void DrawCharC(HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness);
void DrawFishc(HDC hdc);
static int cxClient,cyClient;
HRESULT CALLBACK WindowProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;
switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
DrawFishc(hdc);
EndPaint(hWnd,&ps);
break;
case WM_TIMER:
GetClientRect(hWnd,&rect);
InvalidateRect(hWnd,&rect,TRUE);
break;
case WM_CREATE:
SetTimer(hWnd,1,400,NULL);
srand(time(NULL));
break;
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
break;
case WM_DESTROY:
KillTimer(hWnd,1);
PostQuitMessage(0);
break;
default:
return DefWindowProc(hWnd,message,wParam,lParam);
}
return 0;
}
void DrawStar( HDC hdc,int cx,int cy )
{
XFORM xForm;
int i,savedState = SaveDC(hdc);
double theta = 0;
xForm.eDx= 0.0;
xForm.eDy= 0.0;
SetMapMode(hdc,MM_ISOTROPIC);
SetViewportOrgEx(hdc,cx/2,cy/2,NULL);
SetWindowExtEx(hdc,100,-100,NULL);
SetViewportExtEx(hdc,cx/2,cy/2,NULL);
SetGraphicsMode(hdc,GM_ADVANCED);
for(i=0;i<5;i++)
{
xForm.eM11 = (FLOAT) cos(theta);
xForm.eM12 = (FLOAT) sin(theta);
xForm.eM21 = -xForm.eM12;
xForm.eM22 =xForm.eM11;
SetWorldTransform(hdc, &xForm);
Rectangle(hdc,-10,90,10,0);
theta += 72*3.1415926/180;
}
RestoreDC(hdc,savedState);
}
void DrawStringFishc( HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int thick )
{
XFORM xForm={0};
int savedState = SaveDC(hdc);
int w = (xRight-xLeft-2*thick)/7,h=yBottom-yTop-thick*2;
POINT ptF[]={0,0,w,0,w,thick,thick,thick,thick,h/2-thick/2,w,h/2-thick/2,w,h/2+thick/2,thick,h/2+thick/2,thick,h,0,h};
POINT ptI[]={0,0,w,0,w,thick,(w-thick)/2+thick,thick,(w-thick)/2+thick,thick+(h-2*thick),w,thick+(h-2*thick),w,h,
0,h,0,h-thick,(w-thick)/2,h-thick,(w-thick)/2,thick,0,thick};
POINT ptH[]={0,0,thick,0,thick,(h-thick)/2,w-thick,(h-thick)/2,w-thick,0,w,0,w,h,
w-thick,h,w-thick,(h+thick)/2,thick,(h+thick)/2,thick,h,0,h};
OffsetViewportOrgEx(hdc,xLeft,yTop,NULL);
OffsetViewportOrgEx(hdc,thick,thick,NULL);
//Óöà±ßÐλæÖÆ×ÖĸF¡£
Polygon(hdc,ptF,_countof(ptF));
OffsetViewportOrgEx(hdc,w*3/2,0,NULL);
//Óöà±ßÐλæÖÆ×ÖĸI¡£
Polygon(hdc,ptI,_countof(ptI));
//»æÖÆ×ÖĸS¡£
OffsetViewportOrgEx(hdc,w*3/2,-thick/2,NULL);
DrawCharS(hdc,0,0,w,h+thick,thick);
OffsetViewportOrgEx(hdc,w*3/2,thick/2,NULL);
//Óöà±ßÐλæÖÆ×ÖĸH¡£
Polygon(hdc,ptH,_countof(ptH));
OffsetViewportOrgEx(hdc,w*3/2,0,NULL);
//»æÖÆ×ÖĸC¡£
DrawCharC(hdc,0,0,w,h,thick);
RestoreDC(hdc,savedState);
}
void DrawCharS( HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness )
{
int nSavedDC;
XFORM xForm={0};
nSavedDC = SaveDC(hdc);
xForm.eM11 = xForm.eM22 = -1;//cos(¦Ð)
OffsetViewportOrgEx(hdc,0,nThickness/2,NULL);
DrawCharHalfS(hdc,xLeft,yTop,xRight,(yTop+yBottom)/2,nThickness);
OffsetViewportOrgEx(hdc,0,(yBottom-yTop)/2-nThickness,NULL);
SetGraphicsMode(hdc,GM_ADVANCED);
SetWorldTransform(hdc,&xForm);
DrawCharHalfS(hdc,xLeft,yTop,xRight,(yTop+yBottom)/2,nThickness);
RestoreDC(hdc,nSavedDC);
}
void DrawCharHalfS( HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness )
{
HBRUSH hBrush;
LOGPEN pen;
HRGN hRgnLargeEllipse,hRgnSmallEllipse,hRgnRect,hRgn,hRgnTemp;
int rx,ry,nSavedDC = SaveDC(hdc);
rx = (xRight-xLeft)/2;
ry = (yBottom-yTop)/2;
OffsetViewportOrgEx(hdc,rx,ry,NULL);
hRgnLargeEllipse = CreateEllipticRgn(-rx,-ry,rx,ry);
hRgnSmallEllipse = CreateEllipticRgn(-(rx-nThickness),-(ry-nThickness),rx-nThickness,ry-nThickness);
hRgnRect = CreateRectRgn(0,-ry/4,rx,ry);
hRgn = CreateRectRgn(0,0,1,1);
hRgnTemp = CreateRectRgn(0,0,1,1);
CombineRgn(hRgnTemp,hRgnLargeEllipse,hRgnRect,RGN_DIFF);
CombineRgn(hRgn,hRgnTemp,hRgnSmallEllipse,RGN_DIFF);
PaintRgn(hdc,hRgn);
GetObject(GetCurrentObject(hdc,OBJ_PEN),sizeof(pen),&pen);
if(pen.lopnStyle != PS_NULL)
{
hBrush = CreateSolidBrush(pen.lopnColor);
FrameRgn(hdc,hRgn,hBrush,1,1);
DeleteObject(hBrush);
}
DeleteObject(hRgnLargeEllipse);
DeleteObject(hRgnSmallEllipse);
DeleteObject(hRgnRect);
DeleteObject(hRgn);
DeleteObject(hRgnTemp);
RestoreDC(hdc,nSavedDC);
}
void DrawCharC( HDC hdc,int xLeft,int yTop,int xRight,int yBottom,int nThickness )
{
HBRUSH hBrush;
LOGPEN pen;
HRGN hRgnLargeEllipse,hRgnSmallEllipse,hRgnRect,hRgn,hRgnTemp;
int rx,ry,nSavedDC = SaveDC(hdc);
rx = (xRight-xLeft)/2;
ry = (yBottom-yTop)/2;
OffsetViewportOrgEx(hdc,rx,ry,NULL);
hRgnLargeEllipse = CreateEllipticRgn(-rx,-ry,rx,ry);
hRgnSmallEllipse = CreateEllipticRgn(-(rx-nThickness),-(ry-nThickness),rx-nThickness,ry-nThickness);
hRgnRect = CreateRectRgn(0,-ry/2,rx,ry/2);
hRgn = CreateRectRgn(0,0,1,1);
hRgnTemp = CreateRectRgn(0,0,1,1);
CombineRgn(hRgnTemp,hRgnLargeEllipse,hRgnRect,RGN_DIFF);
CombineRgn(hRgn,hRgnTemp,hRgnSmallEllipse,RGN_DIFF);
PaintRgn(hdc,hRgn);
GetObject(GetCurrentObject(hdc,OBJ_PEN),sizeof(pen),&pen);
if(pen.lopnStyle != PS_NULL)
{
hBrush = CreateSolidBrush(pen.lopnColor);
FrameRgn(hdc,hRgn,hBrush,1,1);
DeleteObject(hBrush);
}
DeleteObject(hRgnLargeEllipse);
DeleteObject(hRgnSmallEllipse);
DeleteObject(hRgnRect);
DeleteObject(hRgn);
DeleteObject(hRgnTemp);
RestoreDC(hdc,nSavedDC);
}
void DrawFishc(HDC hdc)
{
HDC hdcMem;
HBRUSH hBrush;
HBITMAP hBitmap;
int a;
RECT rect,rcClient={0,0,cxClient,cyClient};
int nMinW=cxClient/3,nMinH=cyClient/3;
FillRect(hdc,&rcClient,GetStockObject(WHITE_BRUSH));
rect.left = rand()%(cxClient-nMinW);
rect.top= rand()%(cyClient-nMinH);
rect.right = nMinW+rand()%(cxClient-nMinW-rect.left+1);//¿í¶È¡£
a = (2+rand()%3);//2-4
rect.bottom = rect.right/a;//¸ß¶È¡£
if(rect.bottom>cyClient-rect.top)
{
rect.bottom = nMinH+rand()%(cyClient-nMinH-rect.top+1);//¸ß¶È¡£
rect.right = rect.bottom*a;
}
else if(rect.bottom<nMinH)
{
rect.bottom = nMinH;
rect.right = nMinW;
}
rect.right += rect.left;
rect.bottom += rect.top;
a = (int)hypot(rect.right-rect.left,rect.bottom-rect.top)/30;
hdcMem = CreateCompatibleDC(hdc);
hBitmap = CreateCompatibleBitmap(hdc,a,a);
SelectObject(hdcMem,hBitmap);
SetRect(&rcClient,0,0,a,a);
InvertRect(hdcMem,&rcClient);
hBrush = CreateSolidBrush(RGB(rand()%256,rand()%256,rand()%256));
SelectObject(hdcMem,hBrush);
DrawStar(hdcMem,a,a);
SelectObject(hdc,CreatePatternBrush(hBitmap));
DrawStringFishc(hdc,rect.left,rect.top,rect.right,rect.bottom,a);
DeleteDC(hdcMem);
DeleteObject(hBrush);
DeleteObject(hBitmap);
DeleteObject(SelectObject(hdc,GetStockObject(WHITE_BRUSH)));
}
int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nShowCmd )
{
WNDCLASS wndcls;
HWND hWnd;
TCHAR *szClassName = TEXT("MyWin32App");
MSG msg;
wndcls.cbClsExtra= 0;
wndcls.cbWndExtra = 0;
wndcls.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
wndcls.hCursor = LoadCursor(NULL,IDC_ARROW);
wndcls.hIcon = LoadIcon(NULL,IDI_APPLICATION);
wndcls.hInstance = hInstance;
wndcls.lpfnWndProc = WindowProc;
wndcls.lpszClassName = szClassName;
wndcls.lpszMenuName = NULL;
wndcls.style = CS_HREDRAW | CS_VREDRAW;
if(!RegisterClass(&wndcls))
{
MessageBox(NULL,TEXT("×¢²á´°¿ÚÀàʧ°Ü£¡"),NULL,MB_ICONERROR);
return -1;
}
hWnd = CreateWindow(szClassName,TEXT("CÓïÑÔ Win32 ³ÌÐò"),WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,CW_USEDEFAULT,0,NULL,NULL,hInstance,0);
ShowWindow(hWnd,nShowCmd);
UpdateWindow(hWnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
彳山一几攵
发表于 2015-3-9 17:35:09
include <stdio.h>
#include <windows.h>
void main()
{
inti , j;
for (i=0;i < 65;i++)
{
for (j=0 ;j < i ;j++)
{
printf(" ");
}
printf("Welcome to Fishc");
system("cls");
}
}
彳山一几攵
发表于 2015-3-9 17:35:48
学习 了,有意思的活动