Thread: Help me guyz i m get structed

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    3

    Smile Help me guyz i m get structed

    I m a newbie
    I want to program a app in which i wil enter some randon no like 245
    After it should print the remaing no. Like this 0136789
    It should be sorted.
    Plz budies this is my schol project, i wil get 200 points out of 500 plz help me or give me some flow chart that would help me alot
    Thanx in advance.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Nov 2009
    Posts
    3
    Quote Originally Posted by laserlight View Post
    What have you tried?
    I have tried but not fuly complied it.

    I had only made its assumption.
    Like first store the value in array and then check the value stored in array by 0-9 but my program structed while scaning the values
    as i m a newbie i got mis feeling abt codin so i left it then i think to get some help from c/c++ gurus.

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Show what you've done so far.

  5. #5
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    This is a fairly simple thing to do, with a large variety of ways of completing it. A very simple solution I thought of would use 2 std::string classes if you are able to use them.

    example (incomplete of course ):
    Code:
    #include <iostream>
    #include <string>
    
    /*
    	Goal:
    		1) Type a random integer
    			i.e. 123
    		2) Parse and produce the remaining values from 0-9
    			i.e. 0456789
    */
    
    //This is a quick rough solution
    int main()
    {
    	std::string numbers = "0123456789";
    	std::string input;
    	std::cout << "Input a Number: ";
    	std::getline(std::cin,input);
    
    	for ( int x = 0; x != input.length(); ++x )
    	{
    		for ( int y = 0; y != numbers.length(); ++y )
    		{
    			//Use this to possibly flag the numbers string to manipulate output below
    			/* if block with subscript assignment would be a good choice */
    		}
    	}
    	std::cout << "Leftover Output: ";
    	for ( int x = 0; x != numbers.length(); ++x )
    	{
    		//Think of how to use this in conjunction with the above loop to display the output
    		/* if block with subscript output would be a good choice */
    	}
    	std::cout << "\n";
    	system("pause");
    }
    You could do the same kind of thing with cstring style if you are not allowed to use std::string at this point in your class.

    edit:
    of course there is not any range checking, or checking for incorrect input.

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    why in the hell did you just give him the solution?

    please read the homework policy.

  7. #7
    Registered User
    Join Date
    Nov 2005
    Posts
    673
    Thank you Elkvis, but I gave him part of a possible solution. I would rather not be cussed at for doing nothing wrong. I know the policies and rules of this forum quite well. I recommended what I thought would be a simple way to implement the above code. I did not tell him the conditions to use or the values to assign so I believe I am perfectly within the guidelines set forth in the homework policy.
    Last edited by Raigne; 11-30-2009 at 04:34 PM. Reason: typo

  8. #8
    Registered User
    Join Date
    Nov 2009
    Posts
    3

    Re. Thanq.

    Quote Originally Posted by Raigne View Post
    This is a fairly simple thing to do, with a large variety of ways of completing it. A very simple solution I thought of would use 2 std::string classes if you are able to use them.

    example (incomplete of course ):
    [code]
    #include <iostream>
    #include <string>
    Okie budies,
    Rag has done very much helpful work and helped me to get 100 points and remaining 100 points i wil do, this what i thought i get from.
    Thanq rag. U r a nice bro.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hi guyz... an algorithmic problem
    By ayan_2587 in forum C++ Programming
    Replies: 2
    Last Post: 11-12-2009, 01:47 AM
  2. plz help me out guyz!!!!!!!!
    By galmca in forum C Programming
    Replies: 4
    Last Post: 10-18-2004, 12:27 PM
  3. problem with printing a structed array using for loop
    By Prezo in forum C++ Programming
    Replies: 2
    Last Post: 09-15-2002, 09:00 AM
  4. Hi guyz
    By Unregistered in forum C Programming
    Replies: 0
    Last Post: 02-02-2002, 06:31 AM