logo
down
shadow

My program compiles and when ran, it doesn't give me the input i put in


My program compiles and when ran, it doesn't give me the input i put in

By : Ahimtar HoN
Date : November 21 2020, 03:00 PM
Hope that helps The purpose of my program thus far is to create 4 arrays. 1 'char' array which will take in 10 different string values with each element having a maximum of 25 characters. And 3 other array's that will take in 10 integer values and store them into my array. I compile and run my program, and cycle through my for loops and once completed, I get some weird integer values in the place of my teamName array, and for the 'teamWins' 'teamLosses' and 'teamTies' arrays, it gives me the first value I input for ALL elements in those arrays. I really want to understand how arrays work but I am having trouble declaring them, and using them with input, and output. Can anyone see and explain how I can take in 10 strings with values of 25 characters in each element, and take in 10 integers in the other 3 arrays with elements of 10? I will attach my source code below. , You've got four issues:
code :


Share : facebook icon twitter icon
Program compiles but does not give correct value

Program compiles but does not give correct value


By : Amir Vranjaca
Date : March 29 2020, 07:55 AM
it fixes the issue I am writing a calorie program for my C programming class and when it compiles I don't get the correct output. For example I enter number of calories is 385 and get a total number of chips that exceed the calories I originally entered. I have included the code below. , I think this is the pattern you should adopt
code :
if (total >= 385) {
   *pizza = total / 385;
   total = total - *pizza * 385;
}
if (total >= 170) {
   *chips = total/170;
   total = total - *chips * 170;
}

etc...
mpi program in c compiles but doesnt run

mpi program in c compiles but doesnt run


By : 汪雪建
Date : March 29 2020, 07:55 AM
hop of those help? If you compile with mpicc you need to specify -o to provide target file name.
Try this
code :
mpicc -o mpi_matrix mpi_matrix.c
mpirun -np 4 ./mpi_matrix
mpirun -np 4 ./a.out
My Python program compiles long enough to take input, but won't process the input

My Python program compiles long enough to take input, but won't process the input


By : Melissa
Date : March 29 2020, 07:55 AM
I wish this helpful for you This will produce an IndexError as you cannot assign to indices that do not yet exist
code :
favSubjects2 = []
favSubjects2[0] = in0
favSubjects2[1] = in1
favSubjects2[2] = in2
favSubjects2 = [in0, in1, in2]
why doesnt this program give run time error?

why doesnt this program give run time error?


By : VBcoder
Date : March 29 2020, 07:55 AM
Hope that helps Your program exhibits undefined behavior, the pointer arithmetics you're doing is invalid.
You can only do pointer arithmetics on pointers that actually point into an array, and the result of the addition or subtraction must still point inside the array (or one past its end, if you don't intend to dereference it).
My java program Compiles but it doesnt run because it cannot find or load the main class file

My java program Compiles but it doesnt run because it cannot find or load the main class file


By : TIMI LOOOL
Date : March 29 2020, 07:55 AM
I hope this helps . "P.java" is the name of the source code file. The name of the class is just P, so that's what you should use when trying to run:
Related Posts Related Posts :
  • Pointer calculation in Linux Kernel allocation implementation
  • conflicting types for s32_t in c code for STM32F7xx
  • Getting error in AVL tree
  • LD_PRELOAD and linkage
  • For loop skipping numbers in C
  • C code - Why the output returned unexpected value in my code?
  • C - can variate location be promoted?
  • Signal SIGSEGV recieved: vfprintf.c: No such file or directory?
  • Does Posix thread ID have an one-to-one relation with linux thread ID?
  • C - fgets doesnt wait for input when initializing pointer
  • I cannot perform data validation on my four arrays properly.
  • How do I fix this segmentation fault in my c code
  • How to use pointer to split the string into two strings? C language
  • Knuth List Insertion Method in C
  • Tons of error in Visual Studio 2017 with GetUserNameEx at compile time
  • Invalid conversion of char to float, different codes and no good results
  • Why doesn't my code for checking if a word is a palindrome work?
  • How to find if a graph contains a cycle using a recursive DFS?
  • Memory mapped file cannot be closed without un-mapping, since it's still referenced
  • Why is this simple program giving me seemingly incorrect output?
  • second printf not working when using a variable C-programming
  • Shared memory variable in c
  • Linked List and Pointers in C
  • Counting Character usage in text file? C
  • C: Why does assigning a 2D array of ints to an int** cause CLION to highlight the line?
  • How does fwrite work?
  • Why is my http server printing out the same bytes? (C)
  • The following code doesn't stop looping
  • Strcmp gives segmentation Fault
  • Segmentation fault: 1902 vfscanf.c: No such file or directory
  • Mutex - counting occurrences of a char in files using threads
  • Returning arrays in C instead of switch statements, nested set of values
  • Trying to pass addresses to simple variables to a function (pointers & loops) In C
  • Recursively list directories in C on Linux
  • Math operation in the test expression of the `for` loop - perfomance, optimisation
  • what is the difference between extern char **environ and extern char *environ[]
  • Is it possible to bind a socket to 2 adresses in c?
  • error when compiling testfiles from installed c-algorithms library
  • Count alternating up / down sequences
  • ISR documentation with doxygen
  • How to solve the sum of three digit numbers,with how to calculate the second number
  • Recursion C image compressor algorithm
  • Unix system programming: get a network identifier to be passed to getaddrinfo
  • misaligned address access crash on linux wifi drivers on arc platform
  • Having a character appear repeated times in an array and score counts.
  • Given a number A(=2^N), how to get the N?
  • Reading Hex from an file
  • Realloc affecting fgets
  • Run C server and client files in CLion at the same time
  • How to check last character in command line arguements?
  • How to seperate user input word delimiter as space using strtok
  • Code to add element to the beginning of a list in c - what's the error?
  • assembly output + questions about stacks
  • memory management for a dynamically allocated 2D space
  • Don't get messages with epgm://, while with tcp:// do. Why?
  • C Recursion segmentation fault
  • struct dirent in C d_name[256] and NAME_MAX definition
  • Defining a symbolic constant for GNU .ld script origin
  • Bitwise operations in C coding
  • my open gl doesn't work properly?
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org