Thanks for the help I used a pen and paper and finally figured it out!!
Type: Posts; User: mizzou222
Thanks for the help I used a pen and paper and finally figured it out!!
temp is exactly whats in strings, so I messed up because I am comparing the same strings. If I changed it to strings[i+1] would that work?
Sorry this is just a small part of my program, the other argvs are used for other functions like writing to output ect.
I am having trouble sorting out a list of names in c. I have code for sorting the names, but when I go to print them out they still are in the same order as they were at the beginning so something...
I am having trouble reading in a file of 10 names into an array. Ive already allocated the memory, I just keep getting a seg fault when I try and read in the names. I must be doing something wrong,...
//Libraries
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MAX_NAME_LENGTH 20
#define MAX_ARRAY_LENGTH 25
I actually get a seg fault at line 139, which is the line
"if (class[i].num_C != 0){"
so now im really confused
thanks for the help, ill just ask my TA then if its the fscanf because they always mess that line up for us.
It compiles fine. But then I go to run the program with the input file, and no output is displayed.
so instead of fopen(infile, "r");
I should put fopen("input.txt", "r"); ?
I tried this and it doesnt work either
When I go and compile my lab, I get this one error. If someone could tell me what I am doing wrong that would be awesome, because right now I am stuck. The error seems to be with my fopen statement,...
Sorry, it just takes me forever to do these programs, I am not a computer science major and have never taken programming classes before, so I have to look a lot of stuff up online and it doesnt help...
One second, I am figuring a bunch of them out
I get a lot of errors when I compile my code. It is a big program, and I know you guys have a lot of things to do as well, so I'm not really that optimistic about getting a response, but ill post it...
anyone?
Hey, I finished that one function, so if you have time or if anyone else does could you look over it (I still have 1 func i need to do in the AM)? I'm extremely tired and am going to sleep, but will...
Thanks I will. Im about to upload my full code
How does this look for the infix_to_postfix function?
int i,a=0;
char postfix[MAX_EQU_LEN];
Stack list=create_stack();
for(i=0;infix[i]!='\0';i++){
if(!isOperator(infix,i)){
...
I forgot to include this at the top of the code. Thanks for the help guys!!
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#define MAX_EQU_LEN 100
This is what my program is supposed to output.
Sample Input
(5 + 3)
(3 * 8) /2
5 % 4
Sample output
$ ./HW4 input.txt
(5 + 3) = 8
(3 * 8) / 2 = 12
never mind
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int partition( int a[], int l, int r ) {
int i, t, q= l, p= l + (int) ( (r-l+1) * (double) rand() / (1.0 + (double) RAND_MAX) );
...
$ vim prelab11.c
$ gcc -lm prelab11.c
$ ./a.out
10 10 25 60 75 90 100 150 200 300 500
Heres a trial run. It printed out 2 10s instead of 1. Anyone have any idea why?
Whats that mean?
void quick_sort(int* arr, int start, int end)
Divide and conquer portion of quicksort, compare.
int partition(int* arr, int start, int end)
Choose a random pivot within the bounds of your...