#include bool fun(char* str) //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?{int len=0;for(;str[len] = 0; len ++); //这里的for循环里一开始就是 ; len--;for(int i=0; i

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/29 10:26:42
#include bool fun(char* str) //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?{int len=0;for(;str[len] = 0; len ++); //这里的for循环里一开始就是 ; len--;for(int i=0; i

#include bool fun(char* str) //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?{int len=0;for(;str[len] = 0; len ++); //这里的for循环里一开始就是 ; len--;for(int i=0; i
#include
bool fun(char* str) //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?
{
int len=0;
for(;str[len] = 0; len ++); //这里的for循环里一开始就是 ;
len--;
for(int i=0; i

#include bool fun(char* str) //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?{int len=0;for(;str[len] = 0; len ++); //这里的for循环里一开始就是 ; len--;for(int i=0; i
//程序应该是判断输入字符串是不是对称
#include <iostream.h>

bool fun(char* str)    //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?
{
    int len=0;
    for(;str[len] != '\0'; len ++); //这是是不是应该这样写
                              //for空循环,直到字符串结束符,最终得到字符串长度
    len--;        //此处是为了减去'\0'占用的一个长度
    for(int i=0; i<len; i++,len--)
    {
        if( str[i] != str[len] )//这个是判断字符串首位对称位置的字符是不是相等
            return 0;        //不相等返回0
    }
    return 1;
}

void main()
{
 char str[1024];
 cout<<"请输入一行文字"<<endl;
 cin.getline(str,1024);
 cout<<fun(str)<<endl;
 return;
}

bool :帮我给下面这段C++代码加下注释,因为我自己有点迷糊.想让高手帮我注释下,然后自己看个明白.#include #include #include using namespace std;int main(){string s,result_str; bool has_punct = false; char ch; cout #include bool fun(char* str) //请问这个bool函数究竟是怎么实现功能的,为什么看不懂?{int len=0;for(;str[len] = 0; len ++); //这里的for循环里一开始就是 ; len--;for(int i=0; i C++改错题,下面这个程序哪里出错了?应该怎么改?#include#includeclass CBase{protected:char *ch;public:CBase(char *x){ch=new char[20];strcpy(ch,x);}virtual void fun()=0;virtual void fun1(){cout 当字符串为This Is a c Program,ch的值为’a’输出结果应为:This Is A c ProgrAm#include #include void fun(char str1[],char ch) { // } main() { char str1[80]=This Is a c Program; clrscr(); printf(String is:%s ,str1); fun(str1,'a #include main() {char ch; ch='A'+'5'-'3'; printf(%d,%c ,ch,ch); #include stdio.h double fun(int m) { // } 到底错在哪里啊?#include bool IsPrimer(int val){ int i; for(i=2; i #include #include void main() { char ch; int a,s,k,t; while(ch=getchar()!= ) error C2078:too many initializers 帮忙看下怎么回事、#include stdafx.h #include #include #include using namespace std;int _tmain(int argc,_TCHAR* argv[]){ BOOL CopyFile(C:\12\sku1\asdfasdf.xml,C:\12\asdfasdf.xml,false); } error C2078:too many initializers 帮忙看下怎么回事、#include stdafx.h #include #include #include using namespace std;int _tmain(int argc,_TCHAR* argv[]){ BOOL CopyFile(C:\12\sku1\asdfasdf.xml,C:\12\asdfasdf.xml,false); } bool是什么意思 #include long fun(int n) {long s; if(n #include #include fun(int n) { int k,r; for(k=2;k 这个C++程序是做什么的?我是个初学者,#include //这边程序很不理解;using namespace std;templateclass stack{public:stack();bool isnotempty();private:T sz[num];int point;};template stack::stack(){point=0; }template bool stack::isno #include #include #include void fun (char *s) { FOUNDwhile(*s!=\0){if(*s>='A' && *s = 'a' && *s C语言 这个fun函数哪里错了?#include #include #include void fun(char *a,int b[]){int i;for(i=0;i #include void fun(char c) {if(c>'x') fun(c-1); printf(%c,c); } main() {fun('z');}