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()
{
Ïà¹ØÎÊ´ð£º
µØµãÔÚÉîÛÚÄÏɽ
¡¡¡¡×öCÈí¼þ¡£ÊÔÓÃ2K£¬²»ÖªµÀתÕý¸ø¹«Ë¾Ì¸¶àÉÙºÏÊʰ¡£¿
¡¡¡¡ÁíÍ⣬±¾ÈËС±¾£¬Ó¢ÓïÁù¼¶£¬ÊÔÓÃÈý¸öÔ±íÏÖµÃÒ²ËãÖÐÉÏˮƽ¡£µ«ÊÇÏÖÔÚ»¹²»ÄÜ×öÏîÄ¿¡£ÁíÍâ±ÏҵѧУûÓÐÃûÆø¡£
¡¡¡¡×ªÕý¸ø¹«Ë¾Ì¸¶àÉ ......
ΪʲôCдµÄDLLÎļþC¡¢PBÄܵ÷ÓÃVB²»Äܵ÷Óã¿
VBÀïΪʲôÓеÄDLLÖ±½Óͨ¹ýÒýÓÿÉÒÔʹÓã¿ÓеÄÐèҪͨ¹ýdeclareÉêÃ÷Íⲿº¯Êý£¿ÕâЩDLLÓÐʲô²î±ð£¿
1¡¢ÎªÊ²Ã´PBÄÜͨ¹ýDECLAREÉùÃ÷¶øVB²»ÐУ¿
2¡¢Èç¹ûÕâ¸ödllÖÐµÄ ......
ÏëÖªµÀÿÌõÖ¸Áî»òº¯ÊýµÄϵͳÏûºÄ¡£±ÈÈçϵͳִÐÐint a=0£»µÄ¿ªÏúÊǶàÉÙ¡£ÓÐûÓÐÀàËÆµÄÎĵµÖ®ÀàµÄ¡£²»ÒªºÍÎÒ˵ÓÃʲôclock()º¯ÊýÀ´²âÊÔ¡£ÎÒÏëÒªÏà¹Ø×ܽáºÃµÄÎĵµ
ÏÈ·´»ã±à,È»ºóÄÃ×ÅcpuµÄÖ¸ÁîÊÖ²á²éÿÌõÖ¸ÁîµÄʱ¼äÖÜÆÚ ......
ÎÊһϣº
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
ÎÒÍøÂ繤³ÌרҵµÄ£¬½«À´Ïë×öÍøÂ簲ȫÕâ¿é£¬ÏÖÔÚC»ù±¾ÉϵĶ«Î÷Ã÷°×ÁË£¬¿ÉÊǽÓÏÂÀ´¾Í²»ÖªµÀÔõÑùȥѧϰCÓïÑÔÁË£¬ÊÇ¿´Êý¾Ý½á¹¹»¹ÊǼÌÐø±àC £¿Çëǰ±²£¬Ê¦ÐÖ¸ø¸ö½¨Ò飬»î×ÅÍÆ¼öµêÊéÄ¿£¬ºÜÏ£ÍûÕÒµ½Ò»ÌõºÏÊʵÄ·×ßÏÂÈ¥£¡
......