C :: Accept Password From Standard Input And Goes Through All Possible Combinations Until It Matched

Dec 24, 2014

I've been experimenting a bit and can't find a decent way to make a brute forcing script that accepts a password from standard input, and goes through all possible combinations until it is matched. How to structure the code?

View 1 Replies


ADVERTISEMENT

C++ :: Program That Accept Input For User ID

Oct 28, 2013

I need a program to run that will accept an input for user id. It will take the customer input and capitalize the letters, and return invalid id with the user inputted values. Then if it's valid it will add a counter counting the number of letters and numbers. It will keep track until the user puts in !. It seems when I try to pass values from the array to my toUpper function to capitalize it it doesn't seem to work right.

View 3 Replies View Related

C++ :: How To Change Password Input To Asterisk

Mar 6, 2015

Code:
#include <iostream>
#include <string>
using namespace std;

int main()

[Code] ....

View 6 Replies View Related

C# :: Accept Two Input Parameter And Returns Two Out Values

Jan 26, 2014

class Program {
//Accept two input parameter and returns two out value
public static void rect(int len, int width, out int area, out int perimeter) {
area = len * width;
perimeter = 2 * (len + width);

[Code] .....

why is the static keyword required in the method signature for the rect() method. It will not compile if it is absent. why?

the same is true for this example:

class Program {
static void printvalues(params int[] passedin) {
foreach (var printthis in passedin) {
Console.WriteLine(printthis);

[Code] ....

This code won't compile without the static keyword in the printvalues() method signature. why?

View 13 Replies View Related

C++ :: Program To Input Password - Press Enter Only Once?

Jan 16, 2013

Code:
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main() {
clrscr();
int i=0,flag=1;
cout<<"Enter the password.";

[Code] ....

When I input the password, the Backspace and the Enter keys are not working as they should. Also, I want to know if I can press enter only once to input the password, not twice.

Compiler is Turbo C++ 3.0 on Windows 7.

View 1 Replies View Related

C++ :: Input Validation - Program Cannot Accept Negative Numbers

Nov 12, 2014

#include <iostream>
#include <iomanip>
using namespace std;

// Function Prototype
void sortArray(int array[], int size);

[Code] ....

This program was made to allow students to enter as many test scores as they want and the program will show them in ascending order and then will calculate the average of all test scores. It works wonderful until you enter a negative test score and then it throws the averaging process off. I can't seem to be able to make the program not accept the negative numbers.

View 1 Replies View Related

C :: Why Not The First Line At The Standard Input Read

Mar 21, 2013

Here's my code, it's for a poker hand evaluator

input:
'ad 2d 3d 4d 5d...
...4s 5s 6s 7s 8s'

I think it should go through all the 10 crads and disply the name of each card, but it seems to only do it for the second hand

Code:
include <stdio.h>
#include <ctype.h>
int main( void ) {
char inputtedhand[64];
int z=0, counter=0;
int index;
int i=0,m=0,n=0;

[Code].....

View 3 Replies View Related

C :: How To Signal End Of Standard Input Using Scanf

Oct 30, 2013

so i'm using scanf() this way

Code:

int i;
while (scanf("%i", &i))
printf("%i ", i);
printf("
done
");

i tried several combination of Ctrl+D and "Enter", it's not terminating, Ctrl+C just "cancels" the whole thing without printing "done", i'm running this on linux installed on a PC

View 9 Replies View Related

C/C++ :: Grep Hanging For Standard Input

Mar 5, 2014

So I'm working on an assignment that is roughly about implementing the grep utility, only it has to be programmed in C. The weird nuance of the assignment is that while we are implementing the utility, we can use grep only we cannot pass grep a filename to search through(we are supposed to pipe a line from the file to standard input so that grep can examine it there.) Anyways, when I reach execlp, it will print out what is in stdin from the terminal, but it hangs at that point and I have to press Ctrl+Z to exit. I probably have the most difficulty with using this function, so I came up with a smaller scale model to get the basics down. Anyways, here's my code:

#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main(int argc, char* argv[]){

[Code] ....

View 10 Replies View Related

C/C++ :: Writing And Reading From Standard Input

Mar 18, 2015

I have an HTTP/1.0 webserver that I'm building in C that needs to exhibit CGI script functionality. Specifically, what I'm having trouble with is that I have two processes: process 1 is the webserver, process 2 is the CGI script. I fork in the webserver, and then call exec to run the CGI script (specifically, I used execv()). I've read from the CGI specifications in the RFC that in the case of a webserver receiving a POST request, the CGI script should read the arguments for the POST request from stdin. However, when I write to stdin, it simply echoes what was written to the terminal window and when the CGI script tries to read from stdin, it blocks.

So, with all that said, I'm pretty sure there is some simple conceptual explanation to my problem, but I can't figure it out. Do I need to use pipes or some form of interprocess communication to send the data from the webserver to the CGI script, or can it just be done with stdin (and possible stdout)?

View 2 Replies View Related

C :: Accept Input Number From User And To Convert It Into Array Of Integer

Oct 7, 2014

i was trying to solve a problem in SPOJ and what i wanted to do is to accept an input number from the user and to convert it into a array of integer.

Code:

#include<stdio.h>
int * toarray(int *num);
int main(void)
{
int testCases;
}

[code]....

But whenever i try to print the array in the main function i get only two value and the rest address

Code:

1//number of testCases
23456 //input number
6
2293452
4
2293700
1974439125

Process returned 0 (0x0) execution time : 4.152 s
Press any key to continue. However, if i tried to print the array from within the function, it prints the numbers just fine.

print the array elements from the main program, so that i would be able to go on with the rest of it

View 1 Replies View Related

C++ :: Accept Signed Decimal Integer As Input And Output In Binary

Jan 29, 2015

Write a C++ application program to accept a signed decimal integer as input and output the equivalent 2s complement version in 16-bit binary. Include a space between every four bits in the output string. The input will only be processed by the application if it falls in the valid range that can be represented in 2s complement format with 16 bits. The range of a decimal number from - to + is -32768 to 32767.

View 3 Replies View Related

Visual C++ :: Program Doesn't Accept Input Values True?

Nov 1, 2014

I am making a program which is going to print out a head image according to the input values entered by the user. Here is the code:

Code:
#include <iostream>
#include <string>
using namespace std;
void Sides()
// draws the sides to take proportion

[Code] .....

At first i tried to work program like:

Code:
cout << "plase enter which way you want to print out the head, with parted hair or bald." << endl;
cin >> headstyle;
if (headstyle != "bald" || headstyle != "parted hair" )

But it also had given the same mistake. The program compiles BUT; even if I put in the values bald or parted hair the program prints out "wrong input" then exits.

View 2 Replies View Related

C :: Check To See If String From Standard Input Is Alphanumeric Or Not?

Dec 25, 2014

I'm trying to check to see if a string from standard input is alphanumeric or not. I feel as though there may be a function for this but...

Code:
for(test_pass = i; test_pass < i; i++){
if(test_pass[i] == ('1', '2', '3', '4', '5', '6', '7', '8', '9', '0'))
printf("Your password is alphanumeric!
");
}

The compiler wasn't too happy with this.

View 10 Replies View Related

C :: Using Scanf To Read A Character From Standard Input

Nov 1, 2013

So running the following code

Code:
#include <stdio.h>
int main(void) {
char c;
int i=1;
while (scanf("%c", &c)==1)
printf("loop sequence %i: %c(%i)

[Code] ......

Done it seems a "carriage return" serves two purposes here, one is to signal the program to read in the character typed in before the "carriage return", another serves as a second character typed, how can i do this cleanly, that is without having to use a "carriage return" as the second character to signal "I've typed in the first character already".

View 2 Replies View Related

C++ :: Accept Input Till User Hits Enter With No Text Typed

Feb 27, 2012

It seems to be going null. I can't get a null value, I want it to accept input till the user hits enter with no text typed. I've tried checking to see if the input is NULL, "", and " " all to no avail.

Code:
#include <stdio.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <iostream>
#include <fstream>
#include <string.h>
#include <cstring>
using namespace std;
int main() {
string info = "";

[Code] ....

View 7 Replies View Related

C++ :: Read 100 Elements From Standard Input Device And Store Them In Array

Feb 19, 2014

Write code to do the following:

1) declare a variable ptr as a pointer to int and initialize it to NULL
2) dynamically allocate memory for an array of 100 elements
3) read 100 elements from the standard input device and store them in the array.

This is what I have so far, I'd like to know if its ok or if something is wrong.

int *ptr = NULL;
ptr = new int[100];
cin >> dataPtr [arr];

View 2 Replies View Related

C++ :: Create Structures To Store Information Of The People To Be Matched

Nov 9, 2014

I need to be able to make matches from the data i input, and also classifying between male and female. matches for person with specific traits (not one in the program) i really tried for the first part and now the rest is mentally disturbing me. and also to generate a report of partners found.

#include<string.h>
#include <iostream>
using namespace std;
char username[20];
char storedusername[20];
char password[20];
char storedpassword[20];
int loginresult;
char name[20];

[Code] .....

View 1 Replies View Related

C :: Read Amount Of Order From Standard Input / Compute And Print Total Price After Discount

Apr 13, 2014

A Bookseller makes special discount for multiple orders of a book as follows:

AMOUNT and DISCOUNT as follows.

5-9 5% 10-14 10% 15-19 15% 20+ 20%

Write a C main function to read the amount of order from the standard input and compute and print the total price of the given order after the discount. Assume that unit price of a book is 10.00$

My problem is that.When i start with this

Code:
#include<stdio.h>
#include <stdlib.h>
int main(void)
{
int number;
float TotalPrice;
printf("enter a number:");

[Code] ....

I get 0 if i enter a number between 0 and 4(0 and 4 included). I don't know where I am doing a mistake. I also want to know if i can handle this buy just if statements. or how can i do it by while and for loops ?

View 1 Replies View Related

C++ :: Algorithm For All Possible Combinations?

Mar 7, 2013

A few days ago I got a "bright idea" to see if I could match a string, with an arbitrary length from 1 to 12, to its formulated sequence by using an algorithm to find all possible combinations of the integer combinations from 0 to 9 at each length (1 to 12).

Example: Desired numerical combinations from integers 1 to 3:

At Length 1:

1, 2, 3

At Length 2:

11, 12, 13, 21, 22, 23, 31, 32, 33

At Length 3:

111, 112, 113, 121, 122, 123, 131, 132, 133, 211, 212, 213, 221, 222, 223, 231, 232, 233, 311, 312, 313, 321, 322, 323, 331, 332, 333

And so on until the nth length (in my case a length of 12).

First off, I would like to say that this is not as easy as I thought. I clearly underestimated the problem seeing as I've spent hours attempting to write a working algorithm, but feel like I've made no progress.

Here are a few of my attempts:

Attempt 1:

#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>

[Code]....

I can't exactly explain this one. It works if the length is 2 or less; however, the order of the output is horrendous.

Attempt 3: I tried using recursion, but only found myself getting more and more lost the further I tried developing my function. Cannot find my work for this attempt.

I would really like to figure this out on my own, but I am very stuck as you can see. I also lack time that I can spend working on this since im a full time student.

View 14 Replies View Related

C++ :: How To Output All Possible Binary Combinations

Mar 4, 2014

I need to create a function that outputs all possible binary combinations. I'm really stumped on this. I have to do it with nested loops, and am not sure how to go about it. Below is what I tried so far.

The output should look like this:

00000000
00000001
00000010
00000011
00000100
...
11111110
11111111

Code:

void outputBinary(){
int a[2][2][2][2][2][2][2][2];
for (int i = 0; i < 2; i++){
for (int j = 0; j < 2; j++){

[Code] .....

View 2 Replies View Related

C++ :: Print All Combinations Data

Nov 27, 2013

I wanted to create a 5, 3 combinations. i know how to calculate to get the number of combinations 5 3 would have (which is ten), but it seem it's a bit harder for me to print those data ...

View 2 Replies View Related

C/C++ :: How To Find All Possible Combinations In 2D Array With Given Sum

Feb 26, 2015

How to find all possible combinations of coordinates on a 2d grid with a given sum. The sum is not fixed!

E.g. N=nxm=25 thats our grid.

The sum=distance between points on a grid.

For two points distance=|(x1-x2)+(y1-y2)| point A(X1,Y1) B(X1,Y1)

My interest is to know how to find the combinations of coordinates with a given sum, it doesn't matter how many points are there.

If i enter the sum e.g sum=7 and the program has to show all possible combinations which gives the sum of 7 the number of point does not play in row they might be two or maybe more.

View 4 Replies View Related

C :: Printing All Combinations Of A String Loop

Jan 25, 2013

Code:

#include<stdio.h>
#include<string.h>
#define a 15

[Code]....

I am trying to print all combinations of a string but I couldn't figure out how to do loop for it. Code works only 2-3-4 letters words

View 4 Replies View Related

C++ :: Program For Printing All The Combinations Of A String

Feb 17, 2013

I am trying to write a program for printing all the combinations of a string. Why this program is giving the error message.

"First-chance exception at 0x761bc41f in word.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0026f6b4..
Unhandled exception at 0x761bc41f in word.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0026f6b4.." when i try to run this in MVS 2010

#include<iostream>
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include<conio.h>
void combination(std::string input,int length,std::string buffer,int allowedno)

[Code] .....

View 1 Replies View Related

C++ :: All Possible Combinations For 4 Digits From A 5 Digit Number

Jun 23, 2014

How to get all the possible combinations for 4 digits from a 5 digit number. I need a pair that has both 5 digits and four digits. their sum must be equal to a five digit user input. i.e.

user input : 14690
output:
14690 has pairs 12345 + 2345
2345 came from 12345
lets say that x = 12345 and y =2345
besides y == x%10000

other formula can i have since if i use % and / i will have a lot of declarations....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved