Thread: Need Helpp

  1. #1
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68

    Need Helpp

    Hello, I am new here.. My name is Hendry, you can call me Kim(if you want)..

    I have some problem.. I have already thought of it, but I can't..(like a bounce ball)
    Code:
    input= 1
    output
    *
    
    input= 2
    output
    *
    _**
    
    input=3
    output
    *
    _*_*
    __*_**
     
    4,
    *
    _*___*
    __*_*_*_*
    ___*___*_**
    how to print the "*"..("_" same like space)
    the rules are,
    we aren't allow to use conio.h(goto xy) and array..
    we must use for and selection..
    help me please....
    THanks

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    Are you looking this kind of code

    Code:
    #include <stdio.h>
    
    int main() {
      printf("*___*_*_\n");
      return 0;
    }

  3. #3
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68
    we aren't allowed to use manual keyword such as printf, or use array..
    if we are allowed to use that, I have already finished since yesterday..

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    printf is not a keyword. What are you allowed to use, besides loops and selection statements?
    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

  5. #5
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68
    owh..
    nothing.. the hint is only order use to use selection and for..
    (I think if we use for, we don't have to printf manually one by one line)..

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Kinshara
    owh..
    nothing.. the hint is only order use to use selection and for..
    So, you are not allowed to use any part of the C standard library that is for input and output? In fact, you are not allowed to do input and output? That sounds like your problem cannot be solved given the requirements and the restrictions
    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

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Can you use putchar() or puts() ?

    How shall we display the output?

  8. #8
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68
    nopeee...
    I mean, we are allowed use printf and scanf...
    but we aren't allowed to print one by one,
    eq,
    printf("*______*__*)
    etc

  9. #9
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    First of all i am not very clear about your requirement

    but i think this code can help you that

    Code:
    #include <stdio.h>
    
    int main() {
      int input   = 0;
      int index   = 0;
      int counter = 0;
    
      printf("Please input a number !!!\n");
      scanf("%d", &input);
    
      for (; index < input; ++index) {
        counter = 0;
        for (; counter <= index; ++counter) {
          printf("_");
        }
        printf("*\n");
      }
    
      return 0;
    }

  10. #10
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    I think what your teacher wants that don't try to print _ && * by printf one by one use for, while or do while loop

  11. #11
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68
    I have attach file .txt,, to example input output..

  12. #12
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    Thats what i am saying use printf and scanf for input output and for logic use for and one more for inside that what can i give you hint

    if you want answer than give me 10 USD haaaaaaaaaaaaaaaaaaaaaaaaaaaaaa haaaaaaaaaaaa

  13. #13
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68

    wew.. I need help, not to pay someone to do it.. T_T,,
    actually, I haven't enough money... because, my currency is below USD.. T_T

  14. #14
    Registered User
    Join Date
    Oct 2009
    Location
    While(1)
    Posts
    377
    haaa i think you misunderstood me i am just kidding with you bro

    what i need try to write the code and paste it here and we will start working on your problems

    in that way you can learn something

    if i or someone else will give you the working code you won't understand the how to think the logic of the problem and how to write the c/c++ code on that logic are you getting me

  15. #15
    Registered User
    Join Date
    Oct 2009
    Location
    Indonesia
    Posts
    68
    I have been thinking and trying to make that program for 3 hours... but I still can't get it.. T_T
    the range of input is only 1-9, else will quit..

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Helpp Do Not Know Where To Start
    By sjcc in forum C Programming
    Replies: 6
    Last Post: 03-12-2009, 08:50 AM
  2. simple inheritance problem please help:P
    By miguel811 in forum C++ Programming
    Replies: 9
    Last Post: 02-19-2009, 02:55 AM
  3. C++ helpp
    By nooneelse in forum C++ Programming
    Replies: 6
    Last Post: 09-13-2008, 05:55 PM
  4. helpp c programming assignment :(
    By robdiddy in forum C Programming
    Replies: 2
    Last Post: 04-27-2006, 07:15 AM
  5. helpp
    By Scarvenger in forum C++ Programming
    Replies: 3
    Last Post: 10-21-2005, 06:57 PM