Questions tagged [for]
The for tag has no usage guidance.
13
questions
0
votes
1
answer
25
views
CS50 Plurality: can't compare candidate[0].name and name
I have been doing the plurality problem, from problem set 3. But I have stumbled upon a problem that I can't seem to solve in any way. In the function vote, when I use the first candidate as an its ...
0
votes
1
answer
23
views
What is wrong with my nested loop? Why doesn´t it print what it should?
So, I am trying now to make a pyramid of hashtags which in every row has a number of spaces before from the left side of the hashtag. In the program it starts with a prompt from the user between 1-8 , ...
0
votes
2
answers
56
views
Why does this become an infinite loop?
I am trying to make a pyramid of hashtags somehow which I haven´t figured out yet, and trying my way step by step. (I´m doing the Cs50 course) When I came this far the program is working wohoo so far ...
0
votes
2
answers
201
views
pset1 cash less, problem using for loops
I tried to use for loops to solve the cash (less) problem set, not sure if thats possible. Can this code be fixed or do I need to use while loops instead?
the code compiles, but the output is either (...
0
votes
1
answer
17
views
My for loop in vigenere will not execute
The for loop is not running and I cant figure out why. Everything looks good to me. I need some fresh eyes. Thanks guys!
#define _XOPEN_SOURCE
#include <stdio.h>
#include <unistd.h>
#...
0
votes
1
answer
37
views
Decreasing For Loops
I'm sure this is a very basic question but I'm struggling with this.
Why can't I make a decreasing "For" loop?
My code is below. Why doesn't this work?
I just want to output "Decreasing, 4" "...
0
votes
1
answer
88
views
PSET2 Caesar Bug in Uppercase Case For Loop
having an issue with caesar.c. I've got a loop working for lowercase cases where the key size would cause the key to loop out of alphanumeric characters, but when I try to implement the same loop for ...
0
votes
1
answer
11
views
for cicle itrations
hi guys im wrote testing program to test features for my function and there is only 7 iterations in my for cicle but i malocc`ed more then that tell me why pls(testing string was andrew8mike)
#...
0
votes
1
answer
44
views
won function does not seem to return true (even though it should)
So this has been a little frustrating. Even though the rest of the problem went well I cannot figure out where I went wrong.
Here's the idea; set a counter called value that increments by every time ...
0
votes
1
answer
96
views
Parentheses or Brackets Problem?
I get this error, but I can't find where I forgot a paren / bracket...
int SUM1 = 0;
if ( (length == 13) || (length == 15) )
{
for (int a = 1; a < length; a++2)
{
...
1
vote
1
answer
232
views
pset2 caesar, argv[1]
Ok I'm consistently encountering a peculiar issue that I can't get my head around. this loop should return an error if there is a character other than a digit. When I give a character other than a ...
0
votes
1
answer
25
views
I have a nested for loop, with if conditions that won't print out
My vigenere program, compiles and has most of the check50 test-thingy right. However, I cannot get the program to print out the cipher. Not sure what is legal here or not but I have gone over and ...
1
vote
1
answer
539
views
still needing help with mario
I have read and re-read through the help provided for mario here and other places, but am stuck at getting the right number of lines, but not the right characters in each line (i am substituting a for ...