473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

need some help

15
hi every one, can anyone explain to me the meaning of this code and what does %d means, ans also &no on this,

scanf("%d",&no);

thanks,
Dec 5 '06 #1
2 1019
hi every one, can anyone explain to me the meaning of this code and what does %d means, ans also &no on this,

scanf("%d",&no);

thanks,

A scanf statement is used to accept input. It has 2 parameters -
1st - Format Specifier : it tells the compiler in what format input is to be stored.
various formats may be "%d "-> for integer , "%c" , for character "%f" for
floats.

2nd - parameter is the address of memory where your input is two be stored.
Like your 'no' should be a variable and '&' is "address of operator" means it
is giving you address of no variable.

So we can say that what this state is that store an integer at memory location of "no" variable.

You can have more details of format specification hereFormat Specification
Dec 5 '06 #2
i Havew written a program and by all accounts it should work, i have attached the code below this text, can someone compile it and tell me why it is not working, thanks to anyone who knows why it aint working, cheers


#include <iostream.h>
#include <stdio.h>

void choice1();
void choice2();
void choice3();
void choice4();

int main()
{
int choice;

printf(" Choice Menu\n");
printf("------------------\n");
printf("1. Euro Conversion \n");
printf("2. Yen Conversion \n");
printf("3. Austrailian Dollar Conversion \n");
printf("4. Close Program \n");
printf("------------------\n");
printf("Please Select A Conversion Type: ");
scanf("%d", &choice);

cout << choice <<endl;
switch(choice)
{
case '1':
choice1();
break;
case '2':
choice2();
break;
case '3' :
choice3();
break;
case '4' :
choice4();
break;

} // end switch
} //end main

void choice1()
{
float pounds, euros, rate;
cout<<"How many pounds to convert? $";
cin>>pounds;
rate=1.46;
euros = pounds*rate;
cout<<"Converted to €"<<euros;
}

void choice2()
{
float pounds, yen, rate;
cout<<"How many pounds to convert? £";
cin>>pounds;
rate=1.6;
yen = pounds*rate;
cout<<"Converted to $"<<yen;
}

void choice3()
{
float pounds, austrailiandollar, rate;
cout<<"How many pounds to convert? £";
cin>>pounds;
rate=1.98;
austrailiandollar = pounds*rate;
cout<<"converted to &"<<austrailiandollar;
}

void choice4()
{
cout << "hello";
}
Dec 5 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
5
by: John Flynn | last post by:
hi all i'm going to be quick i have an assignment due which i have no idea how to do. i work full time so i dont have the time to learn it and its due date has crept up on me .. As follows:...
0
by: xunling | last post by:
i have a question about answering ..... this topic is "need help" what do i have to write at te topic line, !after i have klicked the "answer message" button ive tried many possibilities,...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
20
by: mike | last post by:
I help manage a large web site, one that has over 600 html pages... It's a reference site for ham radio folks and as an example, one page indexes over 1.8 gb of on-line PDF documents. The site...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.