Challange #

0 Muttalip ─░pek · March 29, 2015
Hi,

First of all, I want to say "Thank you" for your effort.
I have started to watching your videos 3 days ago. Is there any point that I can improve ?

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <math.h>


int main()
{
char enteredPassword[10];


printf("Please enter your 8 character password and make sure that includes an upper case letter, a number and $ \n");
scanf(" %s", &enteredPassword);


if( isdigit(enteredPassword[0]) || isdigit(enteredPassword[1]) || isdigit(enteredPassword[2]) || isdigit(enteredPassword[3]) || isdigit(enteredPassword[4]) || isdigit(enteredPassword[5]) || isdigit(enteredPassword[6]) || isdigit(enteredPassword[7]) || isdigit(enteredPassword[8]) ) {

if( isupper(enteredPassword[0]) || isupper(enteredPassword[1]) || isupper(enteredPassword[2]) || isupper(enteredPassword[3]) || isupper(enteredPassword[4]) || isupper(enteredPassword[5]) || isupper(enteredPassword[6]) || isupper(enteredPassword[7]) || isupper(enteredPassword[8]) ){

if( enteredPassword[0] == '$' || enteredPassword[1] == '$' || enteredPassword[2] == '$' || enteredPassword[3] == '$' || enteredPassword[4] == '$' || enteredPassword[5] == '$' || enteredPassword[6] == '$' || enteredPassword[7] == '$' || enteredPassword[8] == '$' ) {

printf("You have a completely strong password. \n");
}else {
printf("You need at least one $ in your password! \n");
}

}else{

printf("You need at least one upper case letter in your password! \n");

}


}else {

printf("You need at least one number in your password! \n");

}




return 0;
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Manoj Meena · April 1, 2015
the AGE in your code is an integer thats why it is coming 17.0000
try this....

#include<stdio.h>
# define MYNAME "hello"
int main()
{
    float AGE=21;
   float girlage=(AGE/2+7);
    printf("%s can date girls %f or older",MYNAME,girlage);
    return 0;
}
0 c student · March 29, 2015
Try looking at previously submitted codes and reevaluate your own.
0 Gurpinder Singh · March 29, 2015
Hi,

plz help

how to get age in decimal. I am just beginner.
and i was watching bucky's video in (10th video) on heer files.
so i made the following too

/images/forum/upload/2015-03-29/00fd8e1f3d561d56923f7b3611f1c7db.png

2.

/images/forum/upload/2015-03-29/7203261e16e13c854dca5a68e6415563.png




wen compile this i get: "ben can date girl 17 or older"
but it should give me the output :" ben can date girls 17.5 older"
i have tried using FLOAT but that gives "ben can date girls 0 or longer" :)
pl tell me why that happened and how to fix it
0 Suraj Gautam · June 3, 2015
Muttalip 
This is solved code or what?
0 Manoj Meena · March 31, 2015
Change int girlage  to float girlage
And inside printf change %d to %f
0 Gurpinder Singh · April 1, 2015
thanks manoj, 
i have got the decimal point after execution but still not the right answer .
/images/forum/upload/2015-04-01/fdeed8d6fbc3cd517abd58d3034e5cee.png
  • 1

C

107,346 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator