When you have completed the pset, and you have checked your program works correctly, using check50 you should go at the CS50 submit and upload the file you have written your code in, called the source code. There are very detailed steps at the end of each pset's specification.
You seem to have made quite a few mistakes in your code. This is of course not unusual for someone who's just starting out, so let me point you in the right direction.
You are reading the first reply into a string variable called s. Later on, you refer to it as hungry. Choose whichever you prefer and rename the other instance to the same.
To assign a ...
These characters are used as "wildcards" or placeholders. They are used in conjunction with something like printf().
Very basic example
//declaring an int variable to a value of 5
int x = 5;
//printing "%i" using the value of X
Result would print:
This is because printf is accepting 2 parameters here. When you ...
You cannot compare strings in C to compare strings you must use a function called strcmp()if I remember correctly it should be in the string.h so just #include <string.h> and you should be able to use it.
If both strings are identical it should return 0, if not then the strings are not equal.
The problem lies here:
for(int i = 0; i < keyL - 1; i++)
for(int j = i; j < keyL; j++)
if(key[i] == key[j])
When the loop runs the first time, it will always fail because i == j at the start. It's comparing the first letter in the key to itself. It should start with j = i+1.
There may be other ...
You make a new file by clicking the green plus sign at the top, next to where it says the name of the file you are currently on. On your keyboard, then do command shift S. It will give you options for where to save the file and what the name should be. Name it pseudocode.txt and put it in your mario folder. If this helps, click the check mark or upvote it.
Just a guess, did you open a new file that has yet to be named or saved?
Assuming you're in the CS50 IDE, are you writing your code in a file with the .c extension? The IDE has to see that extension to determine the file type and how to highlight stuff. If you just opened a new file and didn't save it to a .c file, it thinks it's a plain text file.
You did use an undeclared identifier j in the second for loop. It isn't created until and only inside the following 3rd for loop.
The compiler never lies. It might mislead on occasion, but it never lies.
Local variables are not initialised by default. The values you find there are the remains of other variables (or data related to function calls) that occupied that exact same location of the stack previously, for example as part of a get_int or printf call. It's your responsibility to assign a value before you read it. Often that means to initialise the ...
Right now your code is just printing m, bottles is only defined, it is never called.
If you want to declare a variable, but not initialize it, int b; is what you would write. int b = b; assigns a new variable (b) to the previous b, of which you have none.
In "int bottles(int b)", you're saying you want a function ('bottles') who will take an argument ('b');...
The short answer is that you're using the wrong format code. While you can cast the values and make it work, it would be easier to just use the correct code, %lu, for an unsigned long. google printf format codes for more extensive info on the subject.
If this answers your question, please click on the check mark to accept. Let's keep up on forum ...
It is because your Compiler warnings are ON. The return type of sizeof() function is size_t. It is System and Compiler dependant. May be if you Compiler your code on 32 bit machine, it will have difference results and on 64 bit different.
According to the 1999 ISO C standard (C99), size_t is an unsigned integer type of at least 16 bit (see sections 7.17 ...
From your first link choose Index in the Source Code pane (far right). Choose misspellings/. Click on download to the right of speller. It will open with a text editor (like notepad++). It's also in the ZIP file.
The problem lies with your use if isalpha() and islower(). Your code is:
if (isalpha(encryptString[i]) == true)
Surprisingly unintuitively, if the character is an alpha, this will NOT evaluate as a true statement.
If you read the documentation, it says that it returns 0 if false and a non-zero if true. This number varies, depending on the architecture, ...
Your loops mean that you don't print out the right number of # signs. Because your i starts of at 0, on the first pass j = 0 which equals i and so only one pass is printed.
Therefore you need to change the initial value of i and your limit so that on each pass, 2, then 3, then 4 etc. # signs are printed instead of 1, then 2, then 3 etc.