Like Tree1Likes
  • 1 Post By vart

Frustrated cant figure this simple thing out

This is a discussion on Frustrated cant figure this simple thing out within the C Programming forums, part of the General Programming Boards category; Need to create two arrays of integers subtact the two then store results into a third array. Then print all ...

  1. #1
    Registered User
    Join Date
    Sep 2013
    Posts
    2

    Angry Frustrated cant figure this simple thing out

    Need to create two arrays of integers subtact the two then store results into a third array. Then print all 3 arrays. Here is the jumbled crap i have. Hope Someone can help!
    insert
    Code:
    #include <stdio.h>
    
    int main()
    {
    int i, f;
    
    #define nums 10
    int nums [] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
    
    #define num 10
    int num [] = {2, 3, 4, 5, 6, 7, 8 ,9 ,10};
    
    #define totes 10
    int totes[];
    
    for (i=0, i<nums, i++, f=0, f<num, f++)
     nums[f] - num[i] = totes[];
    
    printf( "the results of the arrays are: %d\n", totes);
    printf( "array one is: %d\n", nums);
    printf( "array two is: %d\n", num);
    
    return 0;
    }
    
    




  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    1. define array length once

    Code:
    #define MAX_NUM 10
    2. declare 3 arrays of the dame size

    Code:
    int nums [MAX_NUM] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
    int num  [MAX_NUM]  = {2, 3, 4, 5, 6, 7, 8 ,9 ,10};
    int totes[MAX_NUM];
    3. assignment works from right to left
    Code:
    totes[i] = nums[i] - num[i];
    4. to print array you need to use the loop as well
    nonpuz likes this.
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    Registered User
    Join Date
    Sep 2013
    Posts
    2
    Got everything to compile...now i just cant remember how to make my results show up in command prompt

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  5. #5
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Somebody should delete those horrible sections named


    • "A poor-mans method of using system, OS specific:"
    • "A compiler specific implementation using getch:"
    • "A Unix specific method using terminal modes"


    Why have non-portable stuff in there?

  6. #6
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Quote Originally Posted by SirPrattlepod View Post

    Why have non-portable stuff in there?
    Because not all programmers need portable stuff? Some are programming for specific target?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  7. #7
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Quote Originally Posted by vart View Post
    Because not all programmers need portable stuff? Some are programming for specific target?
    But, it's teaching beginners bad practices where it's not necessary

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trying to do a simple thing...
    By Sembhi in forum C++ Programming
    Replies: 7
    Last Post: 11-18-2007, 08:08 PM
  2. Simple thing
    By Doink in forum C Programming
    Replies: 2
    Last Post: 11-11-2007, 04:20 AM
  3. This one simple thing I cant do for my assignment need help
    By Rumproast23 in forum C++ Programming
    Replies: 9
    Last Post: 09-27-2006, 09:41 PM
  4. Just a simple thing.
    By steveiwonder in forum C++ Programming
    Replies: 14
    Last Post: 11-03-2005, 03:39 PM
  5. newbie needs help comprehending simple thing
    By A helpless one in forum C++ Programming
    Replies: 6
    Last Post: 12-16-2002, 08:23 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21