We use cookies to ensure the best experience for you on our website. By using this website you accept our use of cookies. Ok Read more

Los Santos Roleplay Cops and Robbers
  • Home
  • Forum
  • Information
    • Beginners Tutorial
    • Server Rules
    • Privacy Policy
    • Server Map
  • Statistics
    • Top 25
    • Most Active
    • Server Stats
    • Top Score
    • Groups
    • Turf Stats
  • UCP
    • Dashboard
    • Profile
    • Messaging
    • Houses
    • Vehicles
    • Donation Items
    • Transfers
    • Tag Area
    • Support
    • Logs
  • Shop
    • Shop page
    • Donation items
    • Wearables
    • Memberships
    • Vehicle Addons
    • Vehicles
    • Houses
    • Apartments
    • Groups
    • Get Points
  • Donate
  • Game (UCP) Sign in
Lsrcr Forum • C programming language - Page 2

Lsrcr Forum

Los Santos Roleplay Cops and Robbers
https://ls-rcr.com/forum/

C programming language

https://ls-rcr.com/forum/viewtopic.php?t=72398

Page 2 of 2

Re: C programming language

Posted: June 11, 2016, 3:37 pm
by Naruk
First check the number of characters in a password
Dim pass as string

Input = pass

If pass <= 20characters idk le exact language
Else display(20chars plz)
Then
For i,j, k = pass' characters idk le exact lang
If pass ≠ uppercase
If i = maximum limit Then display(wrong), end
Then next i
Elseif pass[j] ≠ lowercase
If i = maximum limit then display(wrong),end
Then next j
Elseif pass[k] ≠ digit
If k = maximum limit then display(wrong), end
Then next k
Elseif Display(You got the way of how the pass should be done)

Idk 6 months ago when I learned VB6 but forgotten most of dem words already, btw its judt a concept, idk how u translate it

Re: C programming language

Posted: June 11, 2016, 3:46 pm
by IDoNotKeyBind
Jaker wrote:
Here, this is what my bro has written(source: https://gist.github.com/anonymous/25693 ... 4a781c260e)
Code: Select all
#include <stdio.h>
#include <ctype.h>

char s[100];

int main() {
  scanf("%s", s);

  int has_upper = 0;
  int has_lower = 0;
  int has_digit = 0;
  int has_dollar = 0;

  for (char *c = s; *c; ++c) {
    if (isupper(*c)) has_upper = 1;
    if (islower(*c)) has_lower = 1;
    if (isdigit(*c)) has_digit = 1;
    if (*c == '$') has_dollar = 1;
  }

  if (strlen(s) <= 20 && has_upper && has_lower && has_digit && has_dollar)
    puts("Strong");
  else
    puts("Weak");

  return 0;
}
Thank you and to your brother! I would like to thank everyone who posted here and used their brains, domeone might lock this now.

Re: C programming language

Posted: June 11, 2016, 4:02 pm
by [Lsrcr]Oggy
Shirt wrote:
ATGOggy wrote:
Go through all the characters of the password and for a character ch,

1) if (ch >= 'A' && ch <= 'Z') then it's a upper case letter
2) if (ch < 'A' || ch > 'Z') then it's a lower case letter
3) if(isdigit(ch)), then it's a digit
4) if(strlen(password)>=20), this checks if the password has atleast 20 characters
5) if(ch=='$')


EDIT: For going through each characters,

char ch;
for(i=0; i<strlen(password); i++)
{
ch=password;
blah blah blah
}

thank you so much for your guidelines, would definitely try out this.
but what I didn't get here is, this part
char ch; \\got it
for(i=0; i<strlen(password); i++) \\the part which I didn't get
{
ch=password
please explain me that 'for' part.

@Auto;
No, it is not any homework, I was just learning C programming through youtube because it cost too much to learn from any IRL teacher. And I saw this question in some forums I suppose and then was not able to do it. So, I thought let's ask you guys.
@Jaker;
Would appreciate your help, mate.

You know how 'for' loops work, right?

I don't know how to explain it xD So I'll give you an example.
Suppose there's a string -

char string[]={'H', 'e', 'l', 'l', 'o', '\0' }

so value of string[0] will be 'H'
string[1] = 'e'
string[2] = 'l'
string[3] = 'l'
strong[4] = 'o'

Re: C programming language

Posted: June 11, 2016, 4:10 pm
by IDoNotKeyBind
ATGOggy wrote:
Shirt wrote:
ATGOggy wrote:
Go through all the characters of the password and for a character ch,

1) if (ch >= 'A' && ch <= 'Z') then it's a upper case letter
2) if (ch < 'A' || ch > 'Z') then it's a lower case letter
3) if(isdigit(ch)), then it's a digit
4) if(strlen(password)>=20), this checks if the password has atleast 20 characters
5) if(ch=='$')


EDIT: For going through each characters,

char ch;
for(i=0; i<strlen(password); i++)
{
ch=password;
blah blah blah
}

thank you so much for your guidelines, would definitely try out this.
but what I didn't get here is, this part
char ch; \\got it
for(i=0; i<strlen(password); i++) \\the part which I didn't get
{
ch=password
please explain me that 'for' part.

@Auto;
No, it is not any homework, I was just learning C programming through youtube because it cost too much to learn from any IRL teacher. And I saw this question in some forums I suppose and then was not able to do it. So, I thought let's ask you guys.
@Jaker;
Would appreciate your help, mate.

You know how 'for' loops work, right?

I don't know how to explain it xD So I'll give you an example.
Suppose there's a string -

char string[]={'H', 'e', 'l', 'l', 'o', '\0' }

so value of string[0] will be 'H'
string[1] = 'e'
string[2] = 'l'
string[3] = 'l'
strong[4] = 'o'

Thank you for further explanation.
[UC]Agent_Oggy. Right??

Re: C programming language

Posted: June 11, 2016, 4:45 pm
by [Lsrcr]Oggy
IDoNotKeyBind wrote:
[UC]Agent_Oggy. Right??
No, I'm AtgOggy or [Lsrcr]Oggy or Oggy :D

Re: C programming language

Posted: June 11, 2016, 4:47 pm
by IDoNotKeyBind
ATGOggy wrote:
IDoNotKeyBind wrote:
[UC]Agent_Oggy. Right??
No, I'm AtgOggy or [Lsrcr]Oggy or Oggy :D
Ah i though you were that guy, he used to play back in 2013, he was cute tho :O

Re: C programming language

Posted: June 11, 2016, 4:48 pm
by [Lsrcr]Oggy
IDoNotKeyBind wrote:
ATGOggy wrote:
IDoNotKeyBind wrote:
[UC]Agent_Oggy. Right??
No, I'm AtgOggy or [Lsrcr]Oggy or Oggy :D
Ah i though you were that guy, he used to play back in 2013, he was cute tho :O
I'm cute too -_-

All times are UTC
Page 2 of 2
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/