易截截图软件、单文件、免安装、纯绿色、仅160KB

第六章答案 c primer plus

 6.1 编写一个程序,创建一个具有26个元素的数组,并在其中存储26个小写字母,并让该程序显示该数组的内容.
#include <stdio.h>
int main(void)
{
 char a[26] = {'a', 'b', 'c', 'd', 'e', 'f',
     'g', 'h', 'i', 'j', 'k', 'l',
     'm', 'n', 'o', 'p', 'q', 'r',
     's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
 int i;
 for(i = 0; i < 26; i++)
  printf("%c", a[i]);
 return 0;
}
==============================================================
6.2 使用嵌套循环产生下列图案:
$
$$
$$$
$$$$
$$$$$
#include <stdio.h>
int main(void)
{
 int i , j, k;
 for(i = 0; i < 5; i++)
 {
  k = i + 1;
  for(j = 0; j< k; j++)
   printf("$");
  printf("\n");
 }
 return 0;
}
==============================================================
6.3 使用嵌套循环产生下列图案:
F
FE
FED
FEDC
FEDCB
FEDCBA
#include <stdio.h>
int main(void)
{
 char fedcba[6] = {"FEDCBA"};
 int i, j, k;
 for(i = 0; i < 6; i++)
 {
  k = i + 1;
  for(j = 0; j < k; j++)
   printf("%c", fedcba[j]);
  printf("\n");
 }
 return 0;
}
==============================================================
 6.4 让程序要求用户输入一个大写字母,使用嵌套循环产生像下面这样的金字塔图案:
                    A
               ABA
          ABCBA  
     ABCDCBA
ABCDEDCBA
#include <stdio.h>
int main(void)
{
 int len;
 char flag;
 int i,n,p,q;
 printf("Please input trigger character:");
 scanf("%c", &flag);
 printf("Please input length:");
 scanf("%d", &len);
 for(i = 0; i < le


相关文档:

C/C++软件工程师就业求职手册节选一

 1、有符号变量与无符号变量值的变换
  将有符号变量转换为无符号变量,注意负数的转换。
2、数值的交换
  //使用临时变量
   void Swap1(int &a, int &b)
  {
      int temp = a;
      a = b;
   &nbs ......

关于C的有趣问题

//以下程序是实现小写转大写程序
#include<stdio.h>
void to_upper(char *str)
{
    for(;*str !='\0';str++)
    {
        if(unsigned(*str-'a')<='z'-'a')
            *str-='a'-'A';//� ......

C/S与B/S架构

C/S结构,即Client/Server(客户机/服务器)结构,是大家熟知的软件系统体系结构,通过将任务合理分配到Client端和Server端,降低了系统的通讯开销,可以充分利用两端硬件环境的优势。早期的软件系统多以此作为首选设计标准。
B/S结构,即Browser/Server(浏览器/服务器)结构,是随着Internet技术的兴起,对C/S结构的一种变化 ......

c socket 发送http请求

#include <sys/types.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
int main(){
int sockfd;
int len;
struct sockaddr_in address;
int result;
char *strings="GET /svnup/rewrite.php HTTP/1 ......

[收藏]C/C++数组名与指针区别深层探索

根本原因在与左值和右值
char a[10]=“hello”;
sizeof(a);//数组名做左值,具有数组名的属性,是一个指向数组首地址的常量指针
strcpy(a,"abc");//数组名做右值,退化为普通的指针
原文链接:
 http://hi.baidu.com/%D2%C0%BD%A3%D0%F9/blog/item/7bbf36966c92f36a54fb9663.html
作者:宋宝华 e ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号