Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 08-19-2005, 03:45 AM   #1 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 18
OS: XP


Help Needed for Visual C++

I was given a task where i must use a 20-element single-subscripted integer array to read in 20 numbers between 10 and 100,inclusive. And as each number is input,print it only if it is not a duplicate of a number previously input.

I already work on this for 2 days but yet i can't get a good answer...can anyone help me out with this?urgent...i am kinda new to Visual C++ and programming...i would like to thank all of u here first...your help will be greatly appreciated.
melvynlyc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 08-19-2005, 05:04 AM   #2 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 18
OS: XP


i hope to at least get an example for me to refer. Thanks!
melvynlyc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-19-2005, 05:39 PM   #3 (permalink)
Manager, Networking Forums
 
johnwill's Avatar
 
Join Date: Sep 2002
Location: S.E. Pennsylvania, US
Posts: 41,787
OS: Windows 7, XP-Pro, Vista, Linux


Blog Entries: 1
Well, it won't win any style contests, but I just wacked it out in about 10 minutes.

Code:
#include <stdio.h>
#include <stdlib.h>

#define FALSE 0
#define TRUE !FALSE

void main (void)
{
   int numbers[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
   int i,j;
   int temp;
   int match;

   for (i = 0;i < 20;i++)
   {
      temp = 0;

      while ((temp < 10) || (temp > 100))
      {
         printf("Enter a number (%i to go, 999 to quit: ",20-i);
         scanf("%i", &temp);
         if (temp > 998)
            exit(0);
      }

      match = FALSE;

      for (j=0;j < 20;j++)
      {
         if ((temp == numbers[j]) && (numbers[j] != 0))
         {
            match = TRUE;
            break;
         }

      }


      if (!match)
      {
         printf("A new number! : %i\n", temp);
         numbers[i] = temp;
      }

   }

}
__________________
If TSF has helped you, Tell us about it! or Donate to help keep the site up!

Microsoft MVP - Windows Desktop Experience
johnwill is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-19-2005, 10:44 PM   #4 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 18
OS: XP


well john...although the output is not like what i expected...i really appreciate your help...u are great....thanks! I can't really understand the program coz maybe i am too noob...lolz! Anyway...hopefully i can learn more next time from here and from u all guys!
melvynlyc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-21-2005, 07:46 AM   #5 (permalink)
Manager, Networking Forums
 
johnwill's Avatar
 
Join Date: Sep 2002
Location: S.E. Pennsylvania, US
Posts: 41,787
OS: Windows 7, XP-Pro, Vista, Linux


Blog Entries: 1
Gee, I thought the program did what you specified.
__________________
If TSF has helped you, Tell us about it! or Donate to help keep the site up!

Microsoft MVP - Windows Desktop Experience
johnwill is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-22-2005, 05:16 AM   #6 (permalink)
Registered User
 
marksworld88's Avatar
 
Join Date: Aug 2005
Posts: 4
OS: XP


if ur new to programming why not start wth vb 6 pro, im learning it now
marksworld88 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-23-2005, 12:32 PM   #7 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 18
OS: XP


dun misunderstood man...i really appreciate your help...thanks! Maybe my english is not good and u understand the question more than me right???lolz!
Hmm...i will take your suggestion mark...thanks to u too!
melvynlyc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 08-27-2005, 09:30 AM   #8 (permalink)
Manager, Networking Forums
 
johnwill's Avatar
 
Join Date: Sep 2002
Location: S.E. Pennsylvania, US
Posts: 41,787
OS: Windows 7, XP-Pro, Vista, Linux


Blog Entries: 1
Well, if you're going to be a professional programmer, my suggestion would be to stick with C/C++, it's the language of choice for major projects.
__________________
If TSF has helped you, Tell us about it! or Donate to help keep the site up!

Microsoft MVP - Windows Desktop Experience
johnwill is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 09-12-2005, 04:30 AM   #9 (permalink)
Registered User
 
Join Date: Aug 2005
Posts: 18
OS: XP


thanks to u john...i will listen to your words and try to stick with C or C++. But i heard java programmers nowadays are highly demanded...isn't it?

Btw...i have another headache task again john...can u help me out with it?i posted it on a new thread....thanks a lot if u can.
melvynlyc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 07:12 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85