| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 863 人关注过本帖
标题:程序的错误
取消只看楼主 加入收藏
初学遍程
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-4-20
收藏
 问题点数:0 回复次数:0 
程序的错误

以下是我模仿其他的程序写的,可运行时总是显示有为
--------------------Configuration: Cexample3_163 - Win32 Debug--------------------
Compiling...
Cexample3_163.cpp
E:\something\200542625347542\C++应用编程200例\cp3\Cexample3_163\Cexample3_163.cpp(27) : error C2660: 'strcmp' : function does not take 3 parameters
E:\something\200542625347542\C++应用编程200例\cp3\Cexample3_163\Cexample3_163.cpp(46) : error C2660: 'strcmp_put' : function does not take 3 parameters
Error executing cl.exe.

Cexample3_163.obj - 2 error(s), 0 warning(s)
我不知道哪里错的,请各位高手给指点一下,谢谢你啊





程序如下:

#include<iostream.h>
#include<string.h>

void str_input(char* p1,char* p2)
{
cout<<"string1:";
cin>>p1;
cout<<"string2:";
cin>>p2;
}

void strcmp_put(char* p1,char* p2)
{
cout<<"strcmp():"<<endl;
int result=strcmp(p1,p2);
if(result>0)
cout<<p1<<"greater than"<<p2<<endl;
if(result<0)
cout<<p1<<"less than"<<p2<<endl;
if(result==0)
cout<<p1<<"identical"<<p2<<endl;
}

void strncmp_put(char* p1,char* p2,size_t count)
{
cout<<"strncmp():"<<endl;
int result=strcmp(p1,p2,count);
if(result>0)
cout<<p1<<"greater than"<<p2<<endl;
if(result<0)
cout<<p1<<"less than"<<p2<<endl;
if(result==0)
cout<<p1<<"identical to"<<p2<<endl;
}

void main(void)
{
char str1[80],str2[80],p;
int i;

for(i=1;i<=3;i++)
{
str_input(str1,str2);
strcmp_put(str1,str2);
strcmp_put(str1,str2);
strcmp_put(str1,str2,3);
cout<<"-------------------"<<endl;
}
}

搜索更多相关主题的帖子: does something function 
2006-04-28 13:13
快速回复:程序的错误
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016755 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved