Questions tagged [initials]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
61 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
43 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
105 views

CS50x - Problem Set 2 - Initials (less)

I've managed to whip up a solution in Python 3 that seems to work. name = input("") initials = name[0] for i in range(0, len(name)): if (name[i].isspace()): initials += name[i + 1] ...
-1
votes
1answer
70 views

pset 2 Initials - Only printing first letter and new line

Can't for the life of me see why this only prints the first letter! Any help would be greatly appreciated. #include <cs50.h> #include <stdio.h> #include <string.h> #include <...
0
votes
1answer
104 views

Any help with initials(more comfortable) in pset2 is greatly appreciated

Please help me with some advice on completing this problem. I can print out the first letter of someone's first name, but I do not know how to go about printing out the first letter in someone's ...
0
votes
1answer
39 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
60 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
69 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
54 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
43 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
70 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
163 views

Initials more pset2

I do not understand why my first name is printing the same letter twice
0
votes
1answer
38 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
200 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
155 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
0answers
35 views

Logic issue with Initials

I have tried to write the program for initials under the following logic: if there is weird spacing -- > there is a space at the start OR 2 or more space are found together in the string if there is ...
0
votes
1answer
477 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
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
1answer
147 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
113 views

problem with pset 2 initials (more confortable)

im having a problem with initials (More Confortable) in Pset2. The ckeck50 software outputs this: : ( outputs "MB" for " milo banana " \ expected output, but not "MB\u0000\n" But when i try to run ...
0
votes
2answers
156 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
371 views

Initials, but I did it with argv and argc, how do I use get_string?

I made this program that takes a name and prints the initials, but...it takes the name in the command line. How can I use get_string() to create an array of strings instead of argv, and argc wich is ...
0
votes
1answer
136 views

pset2(Alternative Solution opinion

I know theirs a billion ways to implement a solution , heres what i came up with and it passed all the tests. What do you guys think int main(void) { string name = get_string(); void ...
0
votes
1answer
465 views

Problem with pset-2 initials.c (more comfortable)

I'm new to programming and I have solved the less comfortable version of initials.c in pset2 but I'm having trouble with the output of more comfortable version of initials.c. Here's my code: #...
0
votes
2answers
190 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
71 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) { ...
1
vote
1answer
50 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 ...
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
87 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
57 views

initials.c - nested while loop is infinite but i don't understand why

My logic for the initials.c program seems right to me, but my nested while loop is an infinite loop. Could someone please point out what i'm doing wrong? printf("enter name \n"); string full_name = ...
0
votes
1answer
2k views

I have a very simple answer for pset2: Initials (less comfortable), its accepted by CS50 but it _feels_ wrong

So I originally started tackling this problem by making arrays for the intials, iterating through the name from get_string looking for spaces and then adding name[i+1] into the initials array, finally ...
0
votes
1answer
104 views

Pset 2 initials output correct - check50 displays error

I have encountered some problems with pset2 initials more comfortable. The output I get is correct, but check50 shows some error.Can`t find problem. Maybe someone has some hints what is wrong here? #...
0
votes
1answer
84 views

What's the differences between ' ' and '\0' (pset2 intitials)

As far as i understand, \0 represent NULL as in the character after the end of the string. So I thought it would be interchargable with ' ' as in here: int main(void) { string s = get_string(); ...
0
votes
1answer
87 views

I need help I'm stuck LOL

My code works fine but when I run the check50, it shows a lot of error. I think I created a badly designed code. Please help!!!!
0
votes
2answers
78 views

I am having with outputs when my Initials program is checked; why is Milo Banana not done properly

#include<cs50.h> #include<stdio.h> #include<string.h> #include<ctype.h> int main(void) { string s = get_string(); { int n = 0; printf("%c", toupper(s[n]))...
0
votes
1answer
63 views

PSET2 Initials.c initials not being printed out at all

My code just stops after I get the string from the user, and I'm not sure why it isn't continuing. Any pointers? int main (void) { printf("What is your full name?\n"); string s = get_string()...
0
votes
1answer
137 views

Problem with Pset2

Please help me with this program i have compile it hundred times and run check50 and submit50 command but it keeps on saying this and also submission cancel do you mean to submit something please ...
0
votes
1answer
143 views

Pset 2 Initials less comf my code works and passes the test but I would like to know how differenlty could have been implemented

I got initials less comf. pretty quickly thankfully but I would like to know how you guys have implemented the code differently than me. https://gist.github.com/a50582c43587cd3c45d38e9e0c4f956a
0
votes
1answer
111 views

pset2 initials clean up

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main() { string userName; do { userName = GetString(); } while (userName == NULL); if (!...
0
votes
2answers
165 views

Pset2 Initials Failing Check50

My initials program, although it appears correct, fails check50. I'm not sure why - check50 says its not printing a new line, but it does in the terminal. Please help me identify the problem: #...
0
votes
1answer
398 views

Initials (More comfortable) - Segmentation fault

I, like so many others, have ran into the dreaded 'Segmentation fault' error. For the life of me, I just can't figure out where I'm going wrong here. I've tried slowly working through it on a notepad ...
0
votes
1answer
96 views

am on pset2(morecomfortable), the code gives me the desired result but it doesnt pass the check

#include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { string name = GetString(); for (int i = 0, n = strlen(name); i < n; i++)...
0
votes
1answer
455 views

pset2 initials.c more comfortable

I had written the code like this but I am getting the gap between the two characters of output. How to remove this spaces. #include <stdio.h> #include <cs50.h> #include <string.h> ...
0
votes
1answer
53 views

pset2 initials if statement not checking

I've debugged the code below and noticed the program checks the if statement inside the for loop but doesn't run the code inside even when the statement is true. Why is this? Thanks in advance! #...
0
votes
1answer
102 views

pset2 How to get rid of spaces in the end of the milo banana_ _ _ _ (input)?

How to get rid of spaces in the end of the input? My code works perfectly with _ _ milla_ _ _ banana But I have issues with the case if _ _ _ milla_ _ banana_ _ _ when I have spaces in the end How ...
0
votes
1answer
116 views

Pset2 initials problem with printing extra initials

I'm struggling with printing the initials after the first name, I'm following the less comfortable specs, my pseudocode; //prompt user for name and store as string //convert strlen to an integer //...
1
vote
2answers
827 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) #...
0
votes
1answer
122 views

My Initials program from pset2 is only printing the first 2 characters

#include <stdio.h> #include <cs50.h> #include <ctype.h> #include <string.h> int main (void){ string name = GetString(); printf("%c", toupper (name[0])); for (...
0
votes
1answer
79 views

Input names and output the first Initials of the surname and the first name

Am stuck on problem set two. will appreciate any help on this string initial (string a); int main (void) { printf("Give me your name\n: "); string name = GetString(); printf("Give me ...
0
votes
2answers
143 views

pset2 initials directory problem

so I'm pretty much stuck on the basics. I typed in the terminal to try and get a name, but if I try to type in the console, it states that there "is no such file or directory." #include <cs50.h&...