User Profile

Collapse

Profile Sidebar

Collapse
d0ugg
d0ugg
Last Activity: Mar 24 '08, 03:38 AM
Joined: Jan 26 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • d0ugg
    started a topic While Loop Problem
    in C

    While Loop Problem

    Hi all,

    I have a little question, my compiler is giving me the following error:

    error C2784: 'std::basic_ost ream<_Elem,_Tra its> &std::operat or <<(std::basic_o stream<_Elem,_T raits> &,const std::basic_stri ng<_Elem,_Trait s,_Alloc> &)' : could not deduce template argument for 'std::basic_ost ream<_Elem,_Tra its> &' from 'std::istream'
    see declaration of 'std::operator <<'...
    See more | Go to post

  • d0ugg
    started a topic How do I input a text file to a linked list?
    in C

    How do I input a text file to a linked list?

    Hello everyone,

    I need to load a multi-word strings from a file to a linked list in one of my programs, and i'm not sure how to do that.

    my text file looks like this- (the name of the text file is: names.txt)

    Linda
    Martinho
    Marla
    Jose
    Mary
    Luka
    Joseph
    Thiago
    Ruba

    Here is one of my sample code:

    Code:
    #include
    ...
    See more | Go to post

  • d0ugg
    replied to Fraction Program - Reducing it to the lowest terms
    in C
    Nevermind.. I already found the error.
    Thank you for the help,

    ~doug
    See more | Go to post

    Leave a comment:


  • d0ugg
    replied to Fraction Program - Reducing it to the lowest terms
    in C
    Thanks for the help.
    I already got the algorithm to reduce the fraction.

    My header file is looking like this now

    Code:
    // This program was created by Douglas Alves
    // CS 1410
    
    #include <iostream>
    using namespace std;
    
    class fraction
    {
    private:
    	int numerator;
    	int denominator;
    public:
    	fraction() : numerator(0),
    ...
    See more | Go to post

    Leave a comment:


  • d0ugg
    started a topic Fraction Program - Reducing it to the lowest terms
    in C

    Fraction Program - Reducing it to the lowest terms

    Hello everyone,

    I'm creating a program that it is suppose to add, subtract, multiply and also divide fractions and after that, the result has to be reduced to the lowest terms.
    However, I'm not sure how the algorithm of reducing fractions works.
    Here is part of my code:

    Code:
    //Header File
    
    #include <iostream>
    using namespace std;
    
    class fraction
    ...
    See more | Go to post

  • d0ugg
    replied to Templates
    in C
    Oh, okay.

    Thank you very much,

    ~doug
    See more | Go to post

    Leave a comment:


  • d0ugg
    replied to Templates
    in C
    So one more question..
    The member-function definitions of a class template are function templates?

    thanks,

    doug
    See more | Go to post

    Leave a comment:


  • d0ugg
    replied to Templates
    in C
    Alright, I think that I understood.

    Thanks,

    Doug
    See more | Go to post

    Leave a comment:


  • d0ugg
    replied to Templates
    in C
    Do you know where can I find a simple example?
    Thanks

    Doug
    See more | Go to post

    Leave a comment:


  • d0ugg
    started a topic Templates
    in C

    Templates

    Hi,

    I need to create a program that works with class templates and regular function templates.
    Can I create one single program that works with both in the same code?

    Sorry for the question but all programs that I was looking just works with one or the other.

    Thanks,

    doug
    See more | Go to post

  • d0ugg
    replied to Function Program
    in Java
    Hey,

    So I started the code, and I'm getting 2 errors from the compile that I can't figure it out..
    The errors are in those lines
    Code:
    if (testA == 1 || testA == 2 || testA== 3 || testA == 4 || testA == 5)
    		{
    			if(testB == 2 || testB == 3 || testB = 4 || testB == 5)
    			{
    				if(testC == 3 || testC == 4 || testC == 5)
    				{
    					if(testD== 4 || testD ==5)
    ...
    See more | Go to post

    Leave a comment:


  • d0ugg
    replied to Function Program
    in Java
    Okay,

    I like the idea of the for loop.

    Thank you,

    Doug
    See more | Go to post

    Leave a comment:


  • d0ugg
    replied to Function Program
    in Java
    Hi,

    Thanks for the quick answer.

    For example,

    Given the function f, from {1 2 3 4 5}, to itself. Than I have to check if it is a one-to-one function and also if it is a onto function.
    The program will test the following functions:
    f(1) = 4
    f(2) = 3
    f(3) = 1
    f(5) = 2

    Thank you
    See more | Go to post

    Leave a comment:


  • d0ugg
    started a topic Function Program
    in Java

    Function Program

    Hello,

    I need to write a Function program that will check if a function is valid or not and also if the function is onto as well.
    Kind of getting started right now, so any ideas will be great.

    Thank you!
    See more | Go to post

  • Hello!

    Thank you so much for the help everyone..

    Have a good Sunday! ;)

    ~doug
    See more | Go to post

    Leave a comment:


  • Thanks for the support,
    but it is suppose to give the percentage of times that it happened.. But anyways, thanks!
    See more | Go to post

    Leave a comment:


  • Do you mean

    Code:
    int verify_1(int diceA, int diceB, float *roll)
    {
    	if(diceA==diceB)
    	*roll++;
    return *roll;
    }
    ??
    Because the compiler say that it has to return a value...

    ~doug
    See more | Go to post

    Leave a comment:


  • Okay, thanks.
    It looks like this now

    Code:
    int verify_1(int diceA, int diceB)
    {
    	int roll=0;
    	if(diceA==diceB)
    	roll++;
    	return roll;
    }
    But how do I initialize it from the different number everytime?
    Example(Roll=1, roll=2,roll=3.. etc)

    ~doug
    See more | Go to post

    Leave a comment:


  • I started the code again..

    Here is my code now

    Code:
    #include <iostream>
    #include <ctime>
    
    using namespace std;
    
    void randomize();
    int verify_1();
    void calculate_1();
    int rolldie();
    
    void randomize(int *diceA, int *diceB)
    {
    srand((unsigned)+time(NULL));
    *diceA = rand() %6+1;
    srand((unsigned)+time(NULL));
    ...
    See more | Go to post

    Leave a comment:


  • Okay..


    Finally I got one step done..
    I got the loop working correctly..
    Here is the code

    Code:
    for(int total=1; total<=1000000; total++)
    {
    	diceA = rolldie(); //value 1-6
    	diceB = rolldie(); //value 1-6
    		if(diceA==diceB)
    		{	
    			cout << setw(7) << "The dice were equal: " << total << endl;
    		}
    }
    ...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...