Click here to Skip to main content
15,896,606 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Multiple Inheritance problem Pin
CPallini15-Nov-09 20:51
mveCPallini15-Nov-09 20:51 
QuestionRuuning MFC Exe without Oracle Client Pin
hellogany15-Nov-09 17:51
hellogany15-Nov-09 17:51 
Answer[Message Deleted] Pin
Rahul Vaishnav15-Nov-09 19:26
Rahul Vaishnav15-Nov-09 19:26 
GeneralRe: Ruuning MFC Exe without Oracle Client [modified] Pin
Shameel16-Nov-09 5:01
professionalShameel16-Nov-09 5:01 
QuestionHow to store a file in a single variable? Pin
Paulraj G15-Nov-09 17:44
Paulraj G15-Nov-09 17:44 
AnswerRe: How to store a file in a single variable? Pin
Adam Roderick J15-Nov-09 18:20
Adam Roderick J15-Nov-09 18:20 
GeneralRe: How to store a file in a single variable? Pin
Paulraj G15-Nov-09 18:22
Paulraj G15-Nov-09 18:22 
Questionprint it only if it is not a duplicate [modified][solved] Pin
Omegaclass15-Nov-09 14:01
Omegaclass15-Nov-09 14:01 
what is wrong with my code it's kicking me in the head right now and if a kind soul could help me out i would be very grateful, thanks.


here is the goal:

Use a one dimensional array to solve the following problem. Read in 20 numbers,
each of which is between 10 and 100, inclusive. As each number is read, print it only if it
is not a duplicate of a number already read. Provide for the “worst case” in which all 20
numbers are different. Use the smallest possible array to solve this problem.Well,



#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdlib>
#include <limits>
const int x = 20;
using namespace std;


int main()

{ 
	
                  int i = 0;
                  int toss = 0;
	              int count=0;
                  int population[20];
                  int num=0;
	              bool duplicate = false;
                  
 
		      while(1)
              { 
                  			   
	              for (int j = 0; j < x; j++)    // test for duplicate random num
	              {
                     
                      srand(time(NULL));
                      num = rand()%90+11;
                      
                    if (num == population[j])
			    
                    {
					duplicate = true;
			        toss++;
				    //break; 
                    }  // exit the loop if true 
		        
                
                    if (!duplicate)
                    {   // if not duplicate
			          
                     population[j] = num;  // fill the dynamic array
                     count++;
                     } 
                  }

			   
                   
                   for (int ii = 0; ii <= count; ii++)
                   {
                   cout << population[ii]<<" ";
                   }
                   cin.clear();
                   cin.get();
                   }
                   }

AnswerRe: print it only if it is not a duplicate Pin
Chris Losinger15-Nov-09 15:16
professionalChris Losinger15-Nov-09 15:16 
GeneralRe: print it only if it is not a duplicate Pin
Omegaclass19-Nov-09 20:56
Omegaclass19-Nov-09 20:56 
GeneralRe: print it only if it is not a duplicate Pin
Chris Losinger20-Nov-09 4:32
professionalChris Losinger20-Nov-09 4:32 
GeneralRe: print it only if it is not a duplicate Pin
Omegaclass20-Nov-09 14:56
Omegaclass20-Nov-09 14:56 
GeneralRe: print it only if it is not a duplicate Pin
Chris Losinger20-Nov-09 15:16
professionalChris Losinger20-Nov-09 15:16 
GeneralRe: print it only if it is not a duplicate Pin
Omegaclass21-Nov-09 20:31
Omegaclass21-Nov-09 20:31 
QuestionHooking CreateRemoteThread [modified] Pin
hxhl9515-Nov-09 13:50
hxhl9515-Nov-09 13:50 
AnswerRe: Hooking CreateRemoteThread Pin
Naveen15-Nov-09 16:56
Naveen15-Nov-09 16:56 
GeneralRe: Hooking CreateRemoteThread Pin
hxhl9515-Nov-09 17:09
hxhl9515-Nov-09 17:09 
GeneralRe: Hooking CreateRemoteThread Pin
Naveen15-Nov-09 17:17
Naveen15-Nov-09 17:17 
GeneralRe: Hooking CreateRemoteThread Pin
hxhl9515-Nov-09 17:20
hxhl9515-Nov-09 17:20 
GeneralRe: Hooking CreateRemoteThread Pin
Naveen15-Nov-09 17:32
Naveen15-Nov-09 17:32 
GeneralRe: Hooking CreateRemoteThread Pin
hxhl9515-Nov-09 17:39
hxhl9515-Nov-09 17:39 
GeneralRe: Hooking CreateRemoteThread Pin
Naveen15-Nov-09 17:59
Naveen15-Nov-09 17:59 
QuestionWhat Windows API function is called to create / show a dialog box. Pin
hongheo7615-Nov-09 11:43
hongheo7615-Nov-09 11:43 
AnswerRe: What Windows API function is called to create / show a dialog box. Pin
Code-o-mat15-Nov-09 20:25
Code-o-mat15-Nov-09 20:25 
QuestionProblem debugging an app with VC++ Pin
timbk15-Nov-09 10:09
timbk15-Nov-09 10:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.