Search:

Type: Posts; User: cprogrammer1980

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. how do I keep taking input over and over and store it into an array?

    for ex. lets say I have the code:



    printf("\nEnter a number");
    scanf("%d*c*");


    I want it to keep asking that over and over until someone presses a specific character to...
  2. Replies
    5
    Views
    1,561

    I understand what you mean but I am also passing...

    I understand what you mean but I am also passing in a 2nd array and a variable in the same function

    I got it to display the first 4 by changing it to array[i]



    for (i = 1;i<c;i++)
    ...
  3. Replies
    5
    Views
    1,561

    Thanks Jim I tried the code you listed but it...

    Thanks Jim

    I tried the code you listed but it lists then 5 times like this

    Banana Apple Grapes Lemon Tomato

    I am trying to get it to say

    Banana
    Apple
  4. Replies
    5
    Views
    1,561

    how to pass in a global array

    lets say I have an array up here


    char array[5][80] = {"banana","apple","grapes",
    "lemon", "tomato"};

    its a globally declared array

    and in a function...
  5. See the code you used I was doing that exact line...

    See the code you used I was doing that exact line because I know when the string is input by the user

    for ex.

    H e l l o

    H is in the 0 place since it reads it in as an array of chars h is...
  6. I'm lost...sorry I'm thinking either I would...

    I'm lost...sorry

    I'm thinking either I would have to state following all spaces after ignoring the first string, or add a second toupper function that only affects the very first string. . Right?
  7. I used yours taters and it works whether I put it...

    I used yours taters and it works whether I put it right after where I ask for input or right before I re-display the input , it capitalizes all of the letters except for the very first one and so if...
  8. this is where I called it ...

    this is where I called it



    strCase(description);
    printf("\nThe description is %s", description);



    it does capitalize all of them except the very first letter.
  9. Aha I understand now, it only cares about the...

    Aha I understand now, it only cares about the value being passed in and not what the name is or whatever variable name I give.

    Now I tried the code, it works great but it does not capitalize the...
  10. I see, I have one function that takes in the...

    I see, I have one function that takes in the input from the user a second function that re-displays the user input so my guess would be to call it in that second function so it re-displays the input...
  11. I see, It doesn't say anything about more than...

    I see, It doesn't say anything about more than one space so that is fine but
    question as to why you made strcase void?

    Does it automatically do the conversions despite not being called anywhere...
  12. now in the code below would this work for...

    now in the code below would this work for initializing i. I did it after declaring it



    int strCase(char s[])
    {
    int i;
    ...
  13. should I do this using an 'if' statement? ...

    should I do this using an 'if' statement?



    int strCase(char s[])
    {
    int i;
    while (s[i] != '\0')
    {
    ...
  14. where would I initialize 'i' in my code?? When...

    where would I initialize 'i' in my code??

    When I take in the input or when I re-display it?
  15. I got it to work but it still isn't capitalizing...

    I got it to work but it still isn't capitalizing all my letters not sure why :\
  16. Can someone please explain this error?

    void strCase(char s[])
    {
    int i;
    while (s[i] != NULL)
    {
    s[i] = toupper(s[i]);
    ...
  17. fixed thx

    fixed thx
  18. well here is what I have so far ...

    well here is what I have so far


    void strCase(char s[])
    {
    int i;
    while (s[i] != NULL)
    {
    ...
  19. capitalizing only first letter in strings??

    I am trying to take a users input and then use a loop to loop through each individual character in the string the user has inputted. Then while it loops through it capitalizes the first letter only...
  20. How to display something before terminating the program

    Hi all!

    I am very closed to finished with this particular program but I want to be able to display my showCost() function before terminating the entire program when the user is prompted ...
  21. sorry im not following.... I read that email...

    sorry im not following....

    I read that email but are you talking specifically about when I ask for a character input to validate the loop? 'Y' 'N' ??

    Sorry I am a noob :s
  22. Hi everyone, almost done with my code here but...

    Hi everyone, almost done with my code here but for some reason when the user enters 'Y' it does not loop up back to the top of the code. This is very important for me because I need it to display the...
  23. Replies
    1
    Views
    1,139

    doing calculations with functions

    I have gotten all my code to compile and work but there is one little thing I cannot get to work.

    The total() function should be able to return cost * qty and price * qty but I am confused how...
  24. Thank you so much This is the code I have...

    Thank you so much

    This is the code I have now:



    {
    double n;

    printf("\nEnter the %s from %3.2lf to %3.2f:\a", item, min,...
  25. Thanks Jim, So should I change it from an int...

    Thanks Jim,

    So should I change it from an int to a double instead? I see what you mean by the %d part that really confused me.
Results 1 to 25 of 27
Page 1 of 2 1 2