User Profile
Collapse
-
Opps, i don't have the book, but it just shows a picture from what I remember. Of two matrices being added and having a sum. Like my program above.... -
Yeah, let me post it.
...Code:#include <stdio.h> #include <stdlib.h> #define SIZE 10 void addMatrix( int m1[][SIZE], int m2[][SIZE], int size, int m3[][SIZE] ); void printMatrix( int m[][SIZE], int size ); int main ( void ) { int size = 3; int m1[SIZE][SIZE]Leave a comment:
-
What is my teacher asking for? Matrices...
This program adds two square matrices - Algorithm 1-3, Page 35.
Change it to implement the generalized algorithm to add two m x n
matrices.
Matrices, in general, are not square or n x n (n-by-n). The number of
rows may not be the same as the number of columns. Here is an example of
3 x 4 matrix.
2 3 1 0
1 4 2 -1
0 -2 2 3
... -
error C2664: 'parseInput' : cannot convert parameter 2 WHY?
I have no idea why am I getting an error C2664: 'parseInput' : cannot convert parameter 2 from 'main::WORD_STR UCT [200]' to 'struct WORD_STRUCT []'
...Code:#include <stdio.h> #include <stdlib.h> #include <string.h> #define FILENAME 80 #define MAX_SIZE 1000 #define CHAR_SIZE 200 #define FLUSH while(getchar() != '\n') // Prototype Declarations
-
Can someone please explain to me what is my teacher asking me?
Hello, I am new to C and I am new to English. I not sure what palindromes mean. I don't know exactly what my teacher wants me to do. If someone could explain it to me in a different way that would be great. I know its sorta long, but maybe you only have to few the first few paragraphs.
Problem:
Write a program in C that generates number palindromes using the algorithm below (see 3. on the next page) and allows... -
Hello, I'm sorta comfused. Anyway you could provide me with an example? Thanks again.
new line would "c == \n" that would tell me if it would be a new line or not? Sorry, I'm really confused on this problem. Been stuck on it for a few hours now....Leave a comment:
-
Inserting lines when copying file.
Hello, I am trying to write a code to copy a file which I can do as you can see below.
...Code:void copy () { // Local Definitions int c; int closeStatus; FILE* spProverbs ; FILE* spProverbsCopy; // Statements printf("Begin file copy\n"); if (!(spProverbs = fopen ("Proverbs.TXT", "r"))) { printf("Error -
Calendar not working as plan
Hello, I am trying to write up a calendar with no luck. Well, I am trying to test "calcJanFir st", but when I type in the year and send it to calcJanFirst I alway get the same number. No matter what year I put in. I believe I am sending the value incorrectly to calcJanFirst. Can someone check what i'm doing wrong please. Thank you.
...Code:/* Print Calendar */ #include <stdio.h> -
Just another update! I got the program working yay! Thanks for the helpLeave a comment:
-
Well here is a little update. I been messing around the code.
...Code:#include <stdio.h> int year; int whatYear; int main(void) { printf("Please enter a year between 1000 to 3000 first\n"); scanf("%d\n",&year); if(!(year >=1000) || !(year <=3000)) { while(year <1000 || year >3000)Leave a comment:
-
Thanks for the information. I changed the code and understand why, but it still asks to type two numbers if it is is valid or not valid....Leave a comment:
-
Prompts the user to enter another value, until value
Hello I have a small question. I'm trying to loop a question and scan the number that the user input. The user input must be valid such as that it has to between 1000-3000 range. I tried a small code,but just came to my mind that it would ask twice. I want it to stop if the input is valid and if not ask the question again. Anyone can provide me some tips or help. Thanks.
Example
...Code:while (!(year>3000) &&
-
Actually, my teacher told me to use isPrime instead of checkPrime....Leave a comment:
-
Yeah. Am I correctly checking if its a prime or is it wrong? The result I get is completely wrong....Leave a comment:
-
I notice that and changed it to
The question I was asked wasCode:int isPrime(int f, int temp) { if(f==temp) return 1; else if(f%2==0 || f==1) return 0;
Write a function named checkPrime that checks if a number is prime or not. In main() call checkPrime in a loop, to display all prime numbers between...Leave a comment:
-
Sorry, let me try to make it more clear. I want to make a loop that is in main that loops from 2 to 10000. The loop will go through one function "isPrime". isPrime will check to see if a number is a prime or not and will return 1 if it is and if not return 0....Leave a comment:
-
[HOMEWORK] How to check if a number is prime or not
Hello, the code below is what I got so far. I would like the loop to check numbers to 2-10000 and stop at 10000 and begins at 2. The question I have how do you make a function into a loop for.
...Code:/* This program checks if a number is prime or not. */ #include <stdio.h> int isPrime (int n, int f); // Function Declarations int main (void) // Local
-
How about if I wanted
5 $ $ $ $
$ 5 $ $ $
$ $ 5 $ $
$ $ $ 5 $
$ $ $ $ 5
I figured I would change the ++ to -- and make the >=, but that doesn't seem to work for me.Leave a comment:
-
[QUOTE]=DeMan]pyut two gfor loops inside each other:
[/QUOTECode:for(int i=0; i< size i++) { for(int k=0; < size; k++) { //do your printing here, print size if i=k and $ otherwise } //print newline here }
Ahh, I see. Another question how would you put a number in there?
5 $ $ $ $
$ 5 $ $ $
$ $ 5 $ $ ...Leave a comment:
-
...Code:/* ==================== printOne ==================== This function receives the size of pattern one and prints it. For instance, if size is 5, output would be: 5 $ $ $ $ $ 5 $ $ $ $ $ 5 $ $ $ $ $ 5 $ $ $ $ $ 5 Pre size Post pattern one printed */ void printOne ( int size ) { // Local DefinitionsLeave a comment:
No activity results to display
Show More
Leave a comment: