C 练习实例9

C 语言教程 · 2019-02-21 14:12:02

题目:要求输出国际象棋棋盘。

程序分析:国际象棋棋盘由64个黑白相间的格子组成,分为8行*8列。用i控制行,j来控制列,根据i+j的和的变化来控制输出黑方格,还是白方格。

如果出现乱码情况请参考本博客【C 练习实例7】的解决方法。

实例

// Created by www.codercto.com on 15/11/9. // Copyright © 2015年 码农教程. All rights reserved. // #include<stdio.h> int main() { int i,j; for(i=0;i<8;i++) { for(j=0;j<8;j++) if((i+j)%2==0) printf("%c%c",219,219); else printf(" "); printf("\n"); } return 0; }

以上实例输出结果为:

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

XMPP

XMPP

Peter Saint-Andre、Kevin Smith、Remko TronCon / O'Reilly Media / 2009-5-4 / USD 39.99

This practical book provides everything you need to know about the Extensible Messaging and Presence Protocol (XMPP). This open technology for real-time communication is used in many diverse applicati......一起来看看 《XMPP》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具