Re: [C++] - strange things:(
Comparing name and "exit" will only compare the pointers, there will be no string comparison. Take a look at strcmp
Re: [C++] - strange things:(
Quote:
Originally Posted by
Atheist
Comparing
name and "exit" will only compare the pointers, there will be no string comparison. Take a look at
strcmp
still not working:(
Code:
#include <iostream.h>
#include <string.h>
int main()
{
char name[255];
do
{
cout<< "Insert your name:\n";
cin>>name;
cout<< "Hi "<<name<<"\n";
cin>>name;
}
while (strcmp (name, "exit")==false);
return 0;
}
anotherthing: now the 'std::' was give me an error, that's why i delete... strange
Re: [C++] - strange things:(
ok.. now works fine;
Code:
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
int main()
{
char name[255];
do
{
system("cls");
cout<< "Insert your name:\n";
cin>>name;
cout<< "Hi "<<name<<"\n";
cin>>name;
}
while (strcmp (name, "exit")!=0);
return 0;
}
but why takes time to open(in IDE: Visual C ++ 6))?
Re: [C++] - strange things:(
Do you mean it takes a long period of time to open the project, or to run the project?
If it is the latter, I would suggest you look in the output-window of the build process. What is happening when its being slow?
Re: [C++] - strange things:(
Quote:
Originally Posted by
Atheist
Do you mean it takes a long period of time to open the project, or to run the project?
If it is the latter, I would suggest you look in the output-window of the build process. What is happening when its being slow?
when i change the code and click in '!'(build command), the IDE takes very time to open the new exe. but after these, if i click again, don't happens:(
is about being windows 7?
(the output-window seems ok. after saying 'Linking...', it takes 1 minute or 2 for open the exe)
Re: [C++] - strange things:(
anotherthing: if i do these(take off the loop):
Code:
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
char name[255];
//do
//{
system("cls");
cout<<"Insert your name.\n";
cin>> name;
cout<< "Your name is: " << name << "\n";
cin>>name;
//}
//while(strcmp(name,"exit")!=0) ;
return 0;
}
the program executes(in IDE) much more faster(normal speed).
so??? it's my system(windows 7 for the Visual C++6) or otherthing?