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

alfers101

what does this mean? scanf("%d",&n);

  • 2 years ago
  • 2 years ago

  • This Question is Closed
  1. ecdown
    Best Response
    You've already chosen the best response.
    Medals 3

    This means that the program will wait for input and take a (d)ecimal and place it in the address of the n variable .

    • 2 years ago
  2. alfers101
    Best Response
    You've already chosen the best response.
    Medals 0

    so can u rephrase it in "cin" ?? because scanf means cin right??

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

    It means it will prompt the user to input a integer number and store its value in 'n'. %d signifies that the data type of input should be an integer. & signifies that it is stored in a particular address.

    • 2 years ago
  4. ecdown
    Best Response
    You've already chosen the best response.
    Medals 3

    they are similar. scanf is for c and cin is a c++ construct.

    • 2 years ago
  5. alfers101
    Best Response
    You've already chosen the best response.
    Medals 0

    yep. but i want it to be just clear. ahmm by just showing "cin and cout". so can u rephrase that into cin ??

    • 2 years ago
  6. alfers101
    Best Response
    You've already chosen the best response.
    Medals 0

    im using c++ actually not c. so im really confuse

    • 2 years ago
  7. ecdown
    Best Response
    You've already chosen the best response.
    Medals 3

    #include <iostream> using namespace std; int main() { int n; cin >> n; cout << n << endl; return 0; }

    • 2 years ago
  8. ecdown
    Best Response
    You've already chosen the best response.
    Medals 3

    The scanf requires the type to be specified, the cin will display based on the type of variable.

    • 2 years ago
  9. alfers101
    Best Response
    You've already chosen the best response.
    Medals 0

    can u show me a code. printing a pyramid ? for example, i type 5. this would be the output: * ** *** **** *****

    • 2 years ago
  10. ecdown
    Best Response
    You've already chosen the best response.
    Medals 3

    Pyramid example: #include <iostream> using namespace std; int main() { int count; cin >> count; for(int i = 1; i <= count ; i++) { for (int j = 1; j <= i; j++) { cout << "*" ; } cout << endl; } return 0; }

    • 2 years ago
  11. Tomas.A
    Best Response
    You've already chosen the best response.
    Medals 0

    if you use c++ use cin

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

    Scanf is a C standard-library function which reads data from the stdin channel, decodes it according to the format string (argument 1), and stores it in the variable that argument two points to. Lots more info at http://dinkum.com/manuals/?manual=compleat&page=lib_scan.html#Scan%20Functions.

    • 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.