Questions tagged [substitution]
The substitution tag has no usage guidance.
30
questions
0
votes
2
answers
20
views
PSet2, Substitution, Unexpected Output - Nested FOR loops producing repeat iterations
I've tried to figure out how an iteration could repeat itself. Iterations 1 and 4 seem to repeat. I've left in my debugging printf lines so you can see how these iterations in my nested FOR loops are ...
0
votes
1
answer
285
views
cs50 pset2 substitution
hey i think my code is correct, ive compiled it and tested it. check50 is not passing it. the error messages and my code is below. can someone please help?
:( encrypts "This is CS50" as &...
0
votes
0
answers
44
views
PSET2 SUBSTITUTION works fine ONLY if plaintext is UNDER 9 CHAR
I was approaching the end of the substitution problem of PSET2 when I hit a snag I could not solve.
I have already written the code to check the key for the various conditions they provide. My problem ...
1
vote
1
answer
71
views
pset2, problem SUBSTITUTION, Is there more than 1 way to check for repeated characters in the 26-character key?
I have a question concerning pset2, SUBSTITUTION.
I finalized the 3 initial filters of this problem:
character count
argument count
non-alphabetical characters.
now I'm moving to the fourth ...
0
votes
1
answer
62
views
PSET2 Substitution: Trouble only in encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key
so this is my code. All problems are compiled successfully except this one. The output is "Segmentation fault"
this is my code:
#include <stdio.h>
#include <cs50.h>
#include <...
0
votes
2
answers
39
views
Char repetition in key
I 'm trying to avoid char repetition in key
// making chars array of alphabets
string alph = "abcdefghijklmnopqrstuvwxyz";
//making sure that there is no character repitition
char rep[26] = ...
1
vote
3
answers
74
views
Segmentation error on pset2 substitution
I'm trying to work on "substitution" problem set, but I'm getting an error of "Segmentation Fault" when I run the program below:
In this part of the program I just want to check if ...
0
votes
1
answer
46
views
cs50 pset2 substitution Segmentation error
I am stuck at working out what is wrong with my code.
I receive the values entered at the command line,
I ask the user for text,
I validate the command line values as characters of the alphabet and ...
0
votes
1
answer
37
views
Pset2 Substitution My code working when I use debugger and does not working thorough console or test. What am I doing wrong?
Sorry for my English( I am learning.
1.I have make this code, but when I have wrote "isduplicate" function it makes uncatchable bug. Code work as my expectetion only in debugger. So where is ...
0
votes
1
answer
66
views
Substitution Just can't handle invalid keys
My code -
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
bool check_distinct_char(string s);
bool check_char(string s);
...
0
votes
1
answer
33
views
pset2 substitution unable to identify string which has character repetition
Here is my code-
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
bool check_distinct_char(string s);
bool check_char(...
0
votes
2
answers
38
views
pset2 substitution checking if all the characters in the key are different
I have almost finished substitution. Just that I have not yet been able to come up with a elegant way to check if all the characters in the key are distinct hence I used the following way to check if ...
0
votes
2
answers
49
views
PSet2 / Substitution
I am trying to make an upper case key and a lower case key of the one typed by the user but when I use the toupper and tolower functions they turn all my chars into lower or upper. Not just the one I ...
0
votes
1
answer
1k
views
incompatible pointer types passing 'string' (aka 'char *') to parameter of type 'string *' (aka 'char **')
Im writing a funtion that takes string as a argument and gives back a integer.
This function counts lenght of a string entered at the command line argument.
I get an error :" incompatible pointer ...
0
votes
1
answer
216
views
Check50 Substitution error
I am able to execute the code with any errors. The solution(output) to the examples given in the problem set 2 match my solution and yet check50 shows there are a number of issues in the output.
...
2
votes
0
answers
707
views
CS50 - PSET2 - Substitution Segmentation fault
I keep getting 'Segmentation fault' every time I run the code(mentioned below). The code is compiling just fine. It's asking for input and is returning required message when the command line argument ...
0
votes
0
answers
111
views
CS50x pset2 substitution, check50 test returns negative even though output is correct
My code fails only one of the test in check50 even though the output is correct and passes other ones.
The test it fails: :( encrypts all alphabetic characters using DWUSXNPQKEGCZFJBTLYROHIAVM as key ...
0
votes
1
answer
131
views
pset2 substitution not working
im kinda stuck with pset2, substitution. Any help is appreciated.
When trying to convert the plaintext into the ciphertext, the formula just doesnt do anything. I suppose there is something wrong ...
0
votes
1
answer
291
views
Segmentation fault in Substitution - Problem Set 2
I have finally finished writing my code for the Substitution question in Problem Set 2, but Check50 tells me that my code has a segmentation fault when there is a lack of key. My code is as follows:
#...
0
votes
3
answers
552
views
How to reject repeated letters for Substitution in Problem Set 2
I am trying to write some code for the Substitution question in Problem Set 2, but I cannot figure out how to reject the case where a user gives a key with repeated letters. My code thus far is as ...
0
votes
1
answer
211
views
Pset2 - Substitution - "Output not valid ASCII text" error despite correct cipher output
after running check50 I am getting an "output not valid ASCII text" error for the following problems:
:( encrypts "A" as "Z" using ZYXWVUTSRQPONMLKJIHGFEDCBA as key
output not valid ASCII text
:...
0
votes
1
answer
258
views
[Week 2 Substitution.Why does my code fail the checks even if the output is correct?
Here is my code.
Apologies if it is hard to understand / messy.
When I check50 it shows this.
I have a brief idea on how to solve the invalid characters in key but I don't mind some help on that too.
...
0
votes
2
answers
187
views
pset2 substitution - isalpha doesn't seem to recognize letters
I'm relatively inexperienced at programming, but I thought I understood how to use command-line prompts well enough to try the substitution problem. I'm having an issue with isalpha that I don't ...
0
votes
2
answers
383
views
PS2 substitution
I am trying to check that the substitution key contains all the alphabets but am getting error: expression result unused for this line of code: s, l ++;
Can anyone help, this is my code as of now:
...
0
votes
1
answer
118
views
hi, i tried to solve problem set 2 substitution. it gives right output but check50 is giving errors
include
include
include
include
include
int main(int argc, string argv[])
{
if (argc != 2)
{
printf("Usage: ./caesar key\n");
return 1;
}
int k = strlen(argv[1]);
...
1
vote
1
answer
621
views
pset 2-substitution-error handles multiple duplicate characters in key timed out while waiting for program to exit
Im working on substitution from pest 2 and I'm getting everything approved except for the last message: handles multiple duplicate characters in key timed out while waiting for program to exit
Below ...
0
votes
1
answer
312
views
During PSET 2: Substitution, I got an expected expression error for get_string. Please help
substitution.c:24:23: error: expected expression
char* plaintext = get_string();
^
/usr/include/cs50.h:109:53: note: expanded from macro 'get_string'
#define get_string(...) ...
2
votes
1
answer
1k
views
Pset 2 - Substitution - Error - handles multiple duplicate characters in key
I have finished the substitution pset2 problem, however, there was one error when I submitted my assignment.
The description of this error was handles multiple duplicate characters in key. timed out ...
1
vote
1
answer
443
views
PSET2 Substitution - Output seemingly correct, fails check50 (null character?)
thank you for your help in advance! I can't wrap my head around what's wrong with my code as the output is (seemingly) correct. I suspect it has something to do with the null character.
#include <...
0
votes
1
answer
2k
views
Get help in Pset2 Substitution
The Errors-
:) substitution.c exists
:) substitution.c compiles
:( encrypts "A" as "Z" using ZYXWVUTSRQPONMLKJIHGFEDCBA as key
output not valid ASCII text
:...