Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

nickymarden Group Title

What's wrong with this?

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    • 2 years ago
    1 Attachment
  2. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    SALARIO is an array but doesn't have any values so how can anything be printed from it . What is this C?

    • 2 years ago
  3. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    but apart from the values? is it all ok? i think it's C++ my professor told me to run it in Dev C++

    • 2 years ago
  4. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    well can float be an array?

    • 2 years ago
  5. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    FLOAT[] SALARIO = null;

    • 2 years ago
  6. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    thats in java

    • 2 years ago
  7. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    not sure about FLOAT though

    • 2 years ago
  8. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    well, if you're no sure, i dont know what i'm going to do :P

    • 2 years ago
  9. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    do you know what an API is?

    • 2 years ago
  10. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    google C++ API array float

    • 2 years ago
  11. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    RTFD

    • 2 years ago
  12. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yes, i do :)

    • 2 years ago
  13. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    great then look up the stuff I said you need to make an array with values....see what datatypes you can use FLOAT is a data type

    • 2 years ago
  14. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    allot of languages are using strong data typing like this.....var testVar0:String ="testVariable"; thats AS 3.0

    • 2 years ago
  15. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah, but i'll look it up and try again. Thank you :))

    • 2 years ago
  16. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    you have a structural issue more than a API issue.....seperate variable .....methods .....functions in your head. create variable>>>>method does something to the variable>>>>>method ouputs variable and the new variable is stored either in the same variable or a newVariable Then there are events that can call functions from within other functions....not in C++ though that I'm aware.

    • 2 years ago
  17. asnaseer Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    what you have is either a C or C++ program

    • 2 years ago
  18. asnaseer Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    when you say whats wrong with this - what do you mean exactly?

    • 2 years ago
  19. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    FFS C and C++ are the same language its just C++ has a whole bunch of prebuilt methods made for it. Its a higher level language generation 3 I think.

    • 2 years ago
  20. asnaseer Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    correct - which is why it could be either

    • 2 years ago
  21. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    ok

    • 2 years ago
  22. asnaseer Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    nickymarden: what is it that is making you say there is something wrong with it?

    • 2 years ago
  23. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    you don't see the problem?

    • 2 years ago
  24. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I don't see the problem

    • 2 years ago
  25. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I suppose this line populates salario array scanf("%f",&salario[i]);

    • 2 years ago
  26. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I don't know C mush though

    • 2 years ago
  27. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    I guess there is no problem and they don't know how to compile

    • 2 years ago
  28. calmchessplayer Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    oh well have fun you guys I'll be back later too many cooks in the kitchen

    • 2 years ago
  29. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    i don't see a problem, but it isn't running, so i assumed there was one :)

    • 2 years ago
  30. james305 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    What isn't wrong with it may be a better question.. I've patched it up into a running state, but I'll let you diff and figure out what changed.. :) #include <stdio.h> int main(void){ float salario[50]; for(int i=0; i<50; i++){ printf("DIGITE O SALARIO\n"); scanf("%f",&salario[i]); } float aumento = 0; printf("QUAL FOI O AUMENTO?\n"); scanf("%f", &aumento); for(int i=0; i<50; i++){ printf("O SALARIO ANTES ERA %f\n", salario[i]); salario[i]=salario[i] + salario[i]*(aumento/100); printf ("O SALARIO AGORA E %f\n", salario[i]); } return(0); }

    • 2 years ago
  31. finaiized Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Yep, there's problems. On the first for loop, for(int i=0; i<50; l++), you used an L instead of 'i' for some reason. Replace it with for(int i=0; i<50; i++). Secondly, on scanf("%", %aumento), you have two things wrong. 1, the first parameter must include a character format. Since you want to read a float, use %f. Second, the second parameter is an address to the float it is read into. The address of operator is &. So, &aumento. So it's scanf("%f", &aumento); This is most likely C++. It is possibly C99.

    • 2 years ago
  32. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Thaaank you :)) Helped a lot, it's running now :P and yeah, i asked my professor and it's C++ after all :)

    • 2 years ago
  33. kevissen Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    well ur prof wrong its c, 1. printf,scanf is used in c, in c++ we use cout and cin 2. its better to declare ur variable outside a loop, u declared 'i' twice in ur code 3. in ur first for loop use for(i=0; i<50; 1++), that should be for(i=0;i<50; i++) 4. and use a system("pause"); before the return 0 function, its good practice. it will pause the program and wait for user input

    • 2 years ago
  34. nickymarden Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yeah, i got it to run, thank you :))

    • 2 years ago
  35. finaiized Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @kevissen - 1. Just because it uses printf does not mean it's C. 2. You should not declare a variable used only for looping outside of the for loop 3. I pointed that out, but I agree. 4. This is easily the most offending thing and I am wondering how well you know C or C++. system("pause") is a HORRIBLE practice, and isn't in the C/C++ spec. If you want to wait for user input, just insert a scanf or cin.

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.