IDE Trouble

0 Dhawal S · August 12, 2015
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
int main()
{
char a[10];
int n=1;
clrscr();
while(n<=1)
{
cout<<"Enter password ";
gets(a);
n+=1;
clrscr();
cout<<"Enter password ";
for(int i=0;i<strlen(a);i++)
{
cout<<"*";
}
}
getch();
return 0;
}



i hav wriiten dis code so as to, HIDE my entered password
i worked fine in borland turboc
when i used the same code in code::blocks i face alot of errors................
CAN ANY! HELPME OUT!!!!!!!!!!!!!!!!!!!

Post a Reply

Replies

Oldest  Newest  Rating
0 Adam Tindall · August 12, 2015
Hello,

try to delete the .h and take out the 2nd and 4 libraries <>   I don't think C++ has those.  Also, type "using namespace std" below the libraries.

Second, you need to declare in the scope above the main function to let compiler know what to expect ie.  clrscr() and I think two others and where to locate if in another file. Try that and let me know how it works for you.   
0 Lachezar Peshterliev · August 12, 2015
#include<iostream>
#include<conio.h>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
char a[10];
int n=1;
system("cls");
while(n<=1)
{
cout<<"Enter password ";
gets(a);
n+=1;
system("cls");
cout<<"Enter password ";
for(int i=0;i<strlen(a);i++)
{
cout<<"*";
}
}
getch();
return 0;
}


cout<<"Hey,friend :) Try with this in code::blocks or DEV C++ . I've done some redaction . I hope you understand it better :)"<<endl;
0 c student · August 13, 2015
make sure you have a conio.h file in your include folder

#include <iostream>
#include <conio.h>

int main (void) {
    int c;

    while ((c = getch()) != '\r') {
        std::cout << "*";
    }

    return 0;
}
0 Dhawal S · August 13, 2015
Adam Tindall i dint get u can u be more specific!!!!!!!!!!!!plzzz
i dont kno how to declare the scope can u plz tell me
0 Dhawal S · August 13, 2015
Lachezar Peshterliev ·
hmmm i compiled and hav runned the program as per ur alterations but error is poping out tat system is not declared....... plzz help me out
0 Dhawal S · August 13, 2015
c student
hmm i compiled it in turbo c i got an error that std in  {std::cout<<"*";}
it shows an error tat 'std' must be a class or a struct.............
help me out
and plz explain ur code i am unable to understand it................
0 Lachezar Peshterliev · August 14, 2015
c student why don't you put USING NAMESPACE STD; under the #include libraries   
0 Lachezar Peshterliev · August 14, 2015
What is you compiler ??? 
0 c student · August 14, 2015
dunno?? http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
  • 1

C++

107,199 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator