A community for students.
Here's the question you clicked on:
 0 viewing
alfers101
 4 years ago
what does this mean? scanf("%d",&n);
alfers101
 4 years ago
what does this mean? scanf("%d",&n);

This Question is Closed

ecdown
 4 years ago
Best ResponseYou've already chosen the best response.3This means that the program will wait for input and take a (d)ecimal and place it in the address of the n variable .

alfers101
 4 years ago
Best ResponseYou've already chosen the best response.0so can u rephrase it in "cin" ?? because scanf means cin right??

DBhatta
 4 years ago
Best ResponseYou've already chosen the best response.0It 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.

ecdown
 4 years ago
Best ResponseYou've already chosen the best response.3they are similar. scanf is for c and cin is a c++ construct.

alfers101
 4 years ago
Best ResponseYou've already chosen the best response.0yep. but i want it to be just clear. ahmm by just showing "cin and cout". so can u rephrase that into cin ??

alfers101
 4 years ago
Best ResponseYou've already chosen the best response.0im using c++ actually not c. so im really confuse

ecdown
 4 years ago
Best ResponseYou've already chosen the best response.3#include <iostream> using namespace std; int main() { int n; cin >> n; cout << n << endl; return 0; }

ecdown
 4 years ago
Best ResponseYou've already chosen the best response.3The scanf requires the type to be specified, the cin will display based on the type of variable.

alfers101
 4 years ago
Best ResponseYou've already chosen the best response.0can u show me a code. printing a pyramid ? for example, i type 5. this would be the output: * ** *** **** *****

ecdown
 4 years ago
Best ResponseYou've already chosen the best response.3Pyramid 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; }

llib_xoc
 4 years ago
Best ResponseYou've already chosen the best response.0Scanf is a C standardlibrary 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.
Ask your own question
Sign UpFind more explanations on OpenStudy
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
 Engagement 19 Mad Hatter
 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.