C primer plus ϰÌâÇó½â
¸ÃÊéµÚËÄÕµÚÎåÌ⣺
Write a program that requests the user's first name and then the user's last name. Have it print the entered names on one line and the number of letters in each name on the following line. Align each letter count with the end of the corresponding name, as in the following:
Melissa Honeybee
7 8
Next, have it print the same information, but with the counts aligned with the beginning of each name.
Melissa Honeybee
7 8
×¢Òâ´ËÊéǰËÄÕ»¹Ã»ÓÐÁ÷³Ì¿ØÖÆÓï¾äµÄ½éÉÜ£¬
Òò´Ë×÷ÕßÓ¦¸Ã²»ÊÇÈÃÎÒÃÇÓÃforÓï¾äÀ´Íê³ÉÕâ¸öÌâÄ¿£»
ÐÂÊÖÇó½â£¡
#include <string.h>
ʹÓÃstrlen(s)¿ÉÒԵõ½×Ö·û´®sµÄ³¤¶È¡£
È»ºóÓ¦¸Ã»á×öÁ˰ɣ¿
´óÏÀ£¬strlenµÃµ½×Ö·û´®µÄ³¤¶È£»
È»ºóÄØ
´ËÊéǰËÄÕ»¹Ã»ÓÐÁ÷³Ì¿ØÖÆÓï¾äµÄ½éÉÜ£¬
Òò´Ë×÷ÕßÓ¦¸Ã²»ÊÇÈÃÎÒÃÇÓÃforÓï¾äÀ´Íê³ÉÕâ¸öÌâÄ¿£»
»¹ÊDz»»á..........
¾Í´òÓ¡³öÀ´±»£¬¼ÈÈ»Äܵõ½ÁË¡£
´òÓ¡µÄλÖþÍÊǺÏÀí¿ØÖÆ¿Õ¸ñ
ÈçºÎ¿ØÖƿոñ£¿
printf("%md",i);
ÕâÑù£¬Èç¹ûiµÄ³¤¶È²»¹»m£¬¾ÍÔÚÇ°Ãæ²¹ÉϿոñ
¼ÈȻѧC++£¬¾ÍÓñê×¼¿â°É
C/C++ code:
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
Ïà¹ØÎÊ´ð£º
ÒÔǰÔÚVCÀïÃæ½¨Ò»¸ö¹¤³Ì£¬¶¼Ö»ÓÃÒ»¸ö .c Îļþ£¬×òÌìÔÚÒ»¸ö¹¤³ÌÀïÓÃÁËÁ½¸ö .cÎļþÁË£¬Óöµ½ÎÊÌâÁË£¬Çë´ó¼ÒÖ¸µã¡£±ÈÈ磺
File1.c Fil ......
ÎÊһϣº
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
ÎÒ½¨ÁËÒ»¸ö´øÍ·Ö¸ÕëµÄÁ´±í
Í·Ö¸ÕëL ÄÇôÎÒÏëɾ³ýÁ´±í
free(l);ÊÇɾ³ýÁËÍ·½áµã »¹ÊÇÁ¬ËüµÄÏÂÃæµÄ½áµãÒ²Ò»ÆðɾÁË£¿
free(l)ºó »¹ÓÃȫɾһ±ãÂ𣿣¨´ÓÄÚ´æµÄ½Ç¶È ²»ÊÇ´Ó²éÕҵĽǶȿ¼ÂÇ£©
ɾͷ½Úµã
»Ø´ðÍê±Ï ......
ÎÒÊäÈë1 µ«Êä³ö²»ÊÇ1 ÎÊÒ»ÏÂÎÒÄÄ´íÁË?Ö÷ÒªÊDzÎÊýµÄ´«µÝ³ö´íÁ衃 µ«ÎÒÔõôҲ¿´²»³öÀ´ ÎÒµÄÊǵØÖ·´«µÝ
#include "stdio.h"
typedef int type;
typedef struct lnode
{
type elem;
stru ......
ÔÚÏß³ÌÀàÀïÃæ£¬±êʶһÏÂÊÇ·ñÊǵÚÒ»´ÎÇëÇó£¿
ÎÒÒÔǰÓöµ½¹ýÀàËÆµÄÎÊÌ⣬µ±Ê±Êǵã»÷Ñ¡Ïµ¯³öÒ»¸öд°¿Ú£¨ÀàËÆ360£©£¬ÎªÁ˲»²úÉúÖØ¸´µÄ´°¿Ú£¬¼ÓÒ»¸öbooleanÐÍEXIST±äÁ¿£¬±êʾ´°¿ÚÊÇ·ñÒѾ²úÉú£¬Äã¿ÉÒÔͬÑù¼ÓÒ»¸öÀàËÆµ ......