level 2
童年是个风筝
楼主
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
int main(int argc, char ** argv)
{
char pn[100];
char bijiao[100] = { "hello" };
char pr[100], br[100];
printf("Please Input:hello");
cin >> pn;
//if (pn == "hello")
if (strcmp(bijiao, pn))
{
printf("good!");
}
else
{
printf("no!");
}
getchar();
system("pause");
return 0;
}
即使是输入了指定字符串,仍然是false...
2017年09月22日 13点09分
1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
int main(int argc, char ** argv)
{
char pn[100];
char bijiao[100] = { "hello" };
char pr[100], br[100];
printf("Please Input:hello");
cin >> pn;
//if (pn == "hello")
if (strcmp(bijiao, pn))
{
printf("good!");
}
else
{
printf("no!");
}
getchar();
system("pause");
return 0;
}
即使是输入了指定字符串,仍然是false...