Here is what I have now, can anyone help me with inputting the text file?
#include <stdio.h>
#include <stdlib.h>
#define NUMBER_OF_CIRCUITS 5
typedef struct{
Type: Posts; User: Northstar
Here is what I have now, can anyone help me with inputting the text file?
#include <stdio.h>
#include <stdlib.h>
#define NUMBER_OF_CIRCUITS 5
typedef struct{
Oh, I see what you mean I think.
Like this?:
fprintf(outputFile, "%f -- Reliability %c\n", circuits[n].name);
fprintf(outputFile, "%f -- Cost %c\n", circuits[n].name);
Whoops, forgot about the for loop, I had that correct at the lab and then when the file did not save correctly I forgot to put it back in. I don't really understand what I am doing wrong? The TA...
Ok, this is what I think I had before (it as at least pretty close, could be a couple things wrong/different):
#include <stdio.h>
#include <stdlib.h>
#define NUMBER_OF_CIRCUITS 5
...
Crap! I didn't even look at the code before I opened it, just copy and pasted it from what I had done at the lab, and this is not it! I guess it didn't save correctly or something. Ugh! I will try to...
Do you mean that the cost of the circuit and the reliability are fixed? There is another part of the project where I have to take different circuits with different reliabilities and figure out which...
I see, thanks for the help. When I go to integrate the cost into the circuit, is this done in a similar way?
Is there anything wrong with using the enum or is that totally unnecessary? How does it know that A = 0, B =1, etc. without the enum?
Why is the struct outside of int main? Also, don't I need that enum to use my input file? Eventually, I am going to have to do some economics and figure out the best way to do things in terms of the...
Ok, so I have to calculate the reliability of the circuit below (sorry, the picture is somewhat crude). It doesn't really matter if you look at it that much because it is explained below:
...
I have this project about circuit reliability that I am quite confused about.
Sorry for the poor picture, but I'm not the greatest of photoshop artists. Here is the circuit:
...
I wanted someone to explain how to do these. I'm not very good with pointers or arrays and we haven't gone over them for more than an hour or so each, so I'm rather confused. These aren't homework...
I need some help understanding pointers. Two problems that my TA suggested were these:
Arrays A and B each contain 10 integers. Write a function that checks if every element of array A is equal...
So the first program is as simply as just:
void remove_null(char* str)
{
str[strlen(str) - 1] = '\0'; /* Removes last character in array before NULL */
}
?
Nevermind, I figured out how to do it. Thanks.
My Professor said I should look over a couple problems in the book so that I could gain some understanding of strings. We have just briefly touched on them, and we don't have to write any program...
I should have been more specific in my first post. The program needs to have a year entered and then print out the calendar, and then ask the user if they want to continue.
So basically it should...
I need to make a program to make a calendar for any given year. I have a program that will say what day any date in time fell on, and a program that will print out something that looks like a...
Yes! That was the problem! Thanks for all of your guys' help.
Ah, duh!
Ok, but now apparently there is another problem...
I entered 3, 3, 2. It said that the sum was 8 (correct), the product was 18 (correct), num count was 3 (correct), invsum was 1.167...
I recompiled it with num as a doubles, and for some reason it always thinks the product is 1 now, anyone have any ideas? It also thinks sum and num are the same thing (sum = num, instead of equaling...
This program is supposed to calculate the average, geometric mean, and harmonic mean of n number of numbers.
#include <stdio.h>
#include <math.h>
int main()
{
double average,...
Is it? My compiler does not like getchar and so it never shows me what the program actually comes up with, but I did the program in the lab and it just added them all together at once. I think adding...
Oh, whoops, I was very unclear. "I want to change it so that it calculates after every number is entered." <-- That was supposed to mean that I want it to calculate after each new number is entered....
I need it to calculate the new number after each number is entered instead of after all the numbers are entered. I think I figured it out though, by adding brackets around while and sum.