User Profile

Collapse

Profile Sidebar

Collapse
td0g03
td0g03
Last Activity: Jul 10 '07, 08:15 PM
Joined: Jan 17 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • td0g03
    replied to What is my teacher asking for? Matrices...
    in C
    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....
    See more | Go to post

    Leave a comment:


  • td0g03
    replied to What is my teacher asking for? Matrices...
    in C
    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]
    ...
    See more | Go to post

    Leave a comment:


  • td0g03
    started a topic What is my teacher asking for? Matrices...
    in C

    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

    ...
    See more | Go to post

  • 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
    ...
    See more | Go to post

  • 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...
    See more | Go to post

  • td0g03
    replied to Inserting lines when copying file.
    in C
    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....
    See more | Go to post

    Leave a comment:


  • td0g03
    started a topic Inserting lines when copying file.
    in C

    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
    ...
    See more | Go to post

  • td0g03
    started a topic Calendar not working as plan
    in C

    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>
    ...
    See more | Go to post

  • Just another update! I got the program working yay! Thanks for the help
    See more | Go to post

    Leave 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)
    ...
    See more | Go to post

    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....
    See more | Go to post

    Leave a comment:


  • td0g03
    started a topic Prompts the user to enter another value, until value
    in C

    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) &&
    ...
    See more | Go to post

  • Actually, my teacher told me to use isPrime instead of checkPrime....
    See more | Go to post

    Leave a comment:


  • Yeah. Am I correctly checking if its a prime or is it wrong? The result I get is completely wrong....
    See more | Go to post

    Leave a comment:


  • I notice that and changed it to

    Code:
    int isPrime(int f, int temp)
    {
        
         if(f==temp)
              return 1;
         else
         if(f%2==0 || f==1)
              return 0;
    The question I was asked was

    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...
    See more | Go to post
    Last edited by td0g03; Feb 27 '07, 07:20 PM. Reason: added question

    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....
    See more | Go to post

    Leave a comment:


  • td0g03
    started a topic [HOMEWORK] How to check if a number is prime or not
    in C

    [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
    ...
    See more | Go to post

  • td0g03
    replied to How to change/print pattern.
    in C
    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.
    See more | Go to post

    Leave a comment:


  • td0g03
    replied to How to change/print pattern.
    in C
    [QUOTE]=DeMan]pyut two gfor loops inside each other:

    Code:
    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
    }
    [/QUOTE

    Ahh, I see. Another question how would you put a number in there?

    5 $ $ $ $
    $ 5 $ $ $
    $ $ 5 $ $ ...
    See more | Go to post

    Leave a comment:


  • td0g03
    replied to How to change/print pattern.
    in C
    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 Definitions
    ...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...