Questions tagged [initials]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
99 views

error in initials.c when I use my own functions

I have solved the initials program in 2 different ways. In the third way, there is a bug which I am not able to clear, please help me finding it out. code: #include<stdio.h> #include<ctype....
2
votes
2answers
652 views

pset2 initials compiles and outputs correct but errors

I'm having trouble with pset2 initials.c My program compiles and passes each output test, however after each test I get "wasn't expecting "Please enter your name:" The problem states that we are to ...
2
votes
1answer
202 views

pset2 Initials Design Improvements

I was hoping you might be able to help me improve the design of my code. I've solved the initials problem, and it passes check50 on both normal and hacker edition (the hacker edition was incidental), ...
1
vote
1answer
3k views

Implicit declaration of function 'topper' is invalid in C99

I am currently working on pset2 in CS50 and am having trouble with initials.c The compiler does not recognise 'toupper', and I use '#include ' at the top. I just updated everything, so this seems to ...
1
vote
2answers
305 views

Unexpected outputs - initials.c

it's nice to be here! In initials.c in pset2, I am able to extract and capitalize (if necessary) the first letter of the inputted name string, iterate through the string and extract and capitalize ...
1
vote
2answers
840 views

Cs50 problem set 2 Initials

everyone! I have one problem with code initials. It correctly runs but after check50 I've got some issues , among them- ***\ expected output, but not " \u0000\n"***that I can't fix.Help me,please) #...
1
vote
1answer
256 views

pset2: “initials” string usage problem

So people told me that I can't use an array of strings and try to output just the first character of every single string like in this code for example: #include <stdio.h> #include <cs50.h&...
1
vote
1answer
51 views

pset2 Initials - negative index

I finished the Initials (more comfortable) problem, but when trying to detect initials, I'd like to avoid negative indeces. Here's what I used for the detection of initials, if it's not a space at ...
1
vote
2answers
879 views

pset2 hacker - initials.c outputs “MB” for “ milo banana ” expected output, but not “MB\u0000\n”

I'm working on the hacker edition of pset2 and I'm running into a problem with initials.c Here's the spec: Write, in a file called initials.c, a program that prompts a user for their name (using ...
1
vote
1answer
461 views

Difficulty with pset2 initials.c

I am having some difficulty with my code for pset2 initials.c and this is the section of code that I'm stuck on. I am trying to print the character behind the space (ie. the 'B' for Emma Brown) but I ...
1
vote
2answers
220 views

Initials runs, but no output

I run this program in my terminal and it compiles right, but I don't quite understand why, when I type something, no output is printed and the blinking prompt with the home directory shows up again. I ...
1
vote
1answer
144 views

CERT_NOT_YET_VALID

I'm trying to run check50 on my initials.c program for PS2 but it keeps saying "uploading" and then it returns the error CERT_NOT_YET_VALID. I get the same thing actually no matter what Pset I try ...
0
votes
3answers
6k views

Initials (Pset2) Problem

I started "well" this particular pset. It's about "initials". The code is alright it takes the first initial. The problem resides in the fact that just one name cannot be accepted, it has to be better ...
0
votes
1answer
402 views

Pset2 Initials First letter only spam result

I have tried to write this out in myriad different ways but no matter what, entering any string results in the first letter being capitalized and printed ad infinitum until i kill the terminal. i have ...
0
votes
1answer
411 views

pset2 initials isblank

Ok so I am stuck on pset2 initials. My code successfully prints out the first letter. I want to print out the ith character, I'm checking for a space with isblank() with an if statement which if true ...
0
votes
1answer
568 views

Pset 2 Initialise: “result of comparison against a string literal is unspecified”

I've been having this persistent issue that's taken me a day of googling and referencing and still have no idea what's up. Essentially, the code below (which is hopefully commented well enough to make ...
0
votes
2answers
162 views

pset 2 initials (less); “expected prompt for input, not output of…”

I've implemented the code for pset 2 initials (less) and it seems to be working, however, when I test it I get an error I'm struggling to understand. Any help would be greatly appreciated. Below is ...
0
votes
1answer
271 views

Pset2: Initializer list problem

So, while working on the "initials" problem this kind of error appeared after I thought I've finished with my code. error: array initializer must be an initializer list I'm posting my whole code ...
0
votes
1answer
223 views

pset2 initializing segmentation fault

PGM compiles, but when I run it and type my name I'm getting a segmentation fault. Any help is greatly appreciated! Thanks!! My code: int main(void) { // Prompts and retreves user input. ...
0
votes
1answer
61 views

Initials: Not printing second initial

I'm having some trouble getting started with the initials problem. Currently, if the user inputs: John Smith, only J is printed. I'm assuming the program automatically exits after the first print ...
0
votes
1answer
40 views

Access array element by index ERROR

I probably miss something very obvious here. I have a simple program (code below), which gives me error: "format specifies type 'char *' but the argument has type 'char'". I tried changing it to char ...
0
votes
1answer
53 views

expected output, but not “MB\n”

check50_more report : :) initials.c exists :) initials.c compiles :) outputs "MB" for "Milo Banana" :) outputs "MB" for "milo banana" :( outputs "MB" for " milo banana " \ expected output, but ...
0
votes
2answers
193 views

pset2 initials.c, returning first initial

I originally used a for loop (for(int i = 0, n =strlen(name); i < n ; i++), but decided to try a while loop setting i=1. Either way my output is always limited to the first character. I've tried ...
0
votes
1answer
129 views

Pset 2 - Initials help

Have the following code for Pset 2 initials (more) #include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main(void) { string name = get_string(); ...
0
votes
2answers
96 views

Help with Initials.c - programme prints '!' after initials, and other problems?

I feel like if I don't seek help from this forum I will end up finishing my CS50 course in 2020 :'( #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> ...
0
votes
1answer
397 views

help with pset2 initials

having a hard time with this problem set. no problem in getting first letter, it's the letters that follow a space that are giving me a hard time. any hints appreciated. #include <cs50.h> #...
0
votes
2answers
90 views

My string.c works only for two word string, how can i make it work on one and three word string?

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(void) { int i=0; string s = get_string(); if(s != NULL) { while(s[...
0
votes
1answer
314 views

Need help with pset2 Initials!

I've spent maybe 17 hours so far on this 8 of them straight. This is my code: #include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(void); int i,...
0
votes
1answer
150 views

Intitials.C Works With Command Line Arguments - How do I make it work with a prompt?

My code for initials.c works with command line arguments, but how do I make it work with a string? And how do I make it work with multiple names that include spaces? I have tried to make it work with ...
0
votes
1answer
644 views

Code i implemented for initials.c

I am working on pset2 initials. and this is the code i have so far the first part of the for loop works properly, because it returns the first letter of the string in uppercase. However, below that ...
0
votes
2answers
510 views

Getting initials from a name

I am working on pset2's initials.c where the goal is to return the initials in upper case. I figured out how to get the initials of the first name, but i am not sure how to get the second name. For ...
0
votes
2answers
203 views

Pset2: Trouble prompting user for input [closed]

int main(int argc, string argv[]) { for (int i = 1; i < argc; i++) { printf("%c", toupper(argv[i][0])); } printf("\n"); } My code does everything asked of pset2 Initials! I can't seem ...
0
votes
1answer
552 views

pset2 initialis

I've struggling this problem for couple of hours and still didn't make it. I keep getting error on the last printf. I used %s or %c for the first one and it shows data argument not used by format ...
0
votes
2answers
390 views

problem with pset2 initials

My code has a problem with output. It prints only two simbol. And second simbol it's not correct string s = GetString(); printf("%c", toupper(s[0])); for (int i = 0, n = strlen(s); i < n; i++) { ...
0
votes
4answers
2k views

ONLY capitalize first letter of words in string initials.c

I am a coding newbie struggling with initials.c in pset2. I am getting closer thanks to the help of many of you. My code below now capitalizes the first letter of the string and finds every next word ...
0
votes
1answer
265 views

pset 2: initials.c has segmentation fault (core dumped)

My program for initials.c found in pset 2 keeps crashing. I am new to programming so any help for the reason behind this would be great. The pset gives these instructions: Write a program that ...
0
votes
1answer
1k views

Pset2, initials.c, program runs but getting bizarre outputs.

I don't think my code is that accurate for the purpose of this problem. The goal is to print and capitalise the first letters of a user's name. I'm having the most trouble finding out how to move ...
0
votes
1answer
575 views

Why “MB” is not correct for check50's: 'outputs “MB”'?

Check50 and I agree in the fact that my initials.c program exists and compiles. However, I am not getting the happy face for the next 5 tests of check50. The prompt of check 50 is this. :( outputs "...
0
votes
1answer
76 views

PSet2 Initials.c 'more comfortable'

Glad to be here. I have a slight issue. I have searched and I want to avoid using 'isalpha' if I can. That seems like the easy way out but I just can't find out how the last 2 checks on the check50 ...
0
votes
1answer
45 views

Infinite loop in pset2 Initials

#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int i; int main (void) { printf("Your Name: "); string s = get_string(); if (s !=NULL) { printf("%...
0
votes
1answer
40 views

Initials, more: Can't get it to loop back after 1 letter

The "more comfortable" version seemed most interesting, so I gave it a shot. //declare the string "nms" and prompt for string input printf("What is your name?\n"); string nms=get_string(); /...
0
votes
1answer
70 views

pset 2 initials: trouble printing only first char and char after space

So here is my current approach. I'm struggling with printing only the first character and the first character after a space in the problem. I feel like I'm pretty close but can't seem to figure out ...
0
votes
1answer
55 views

PSET2 initials.c Once again, appears to compile and run just fine, check50 fails me across the board

include #include <cs50.h> #include <string.h> int main(void) { //get user name through stdin printf("Please enter your name: "); int lastChar = 32; string a = get_string(...
0
votes
1answer
46 views

pset2: initials - strange output with certain array sizes

I noticed a strange behaviour in my code. With specific size assigned to the array used for storing the initials, there are some extra characters stored in the initials array. Below is the code that ...
0
votes
1answer
71 views

pset2 initials check50 bug, doesn't recognize the output

Click here to see the code, initially I've written a simplified version in the main function and it passed all the tests, and then I made the general function seen in the link provided and now it ...
0
votes
1answer
221 views

pset2: initials - check50

First thank you all for taking the time to help! Working on more initials (more comfortable) and here's the problems: 1) From what I see the code gets correct results but check50 doesn't agree. Can ...
0
votes
1answer
164 views

initials-more - check50 says output is correct yet still fails

Bizarre question! Here's the results for my check50 on my initials-more problem: https://cs50.me/checks/815aa9b0c96b6d2a3df539987aa9d8829c5200af It shows that my output returns "HJ" as it should do -...
0
votes
1answer
484 views

check50 not working 2017 for initials

I copied check50 cs50/2017/x/initials/less like shown on pset2 and i get the "Checking. invalid ID" error. I added initials.c at the end and nothing.
0
votes
1answer
150 views

Pset2 initials, how to get to second word

please dont laugh at me as i am totally new to programming, and on top of that maybe not very smart. I am just enjoying a lot what i am learning though i am afraid i will not be able to finish the ...
0
votes
1answer
83 views

pset2 segmentation fault

I have one problem with this code please help me! #include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> int main(void) { ...