473,405 Members | 2,176 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,405 software developers and data experts.

Need help Converting code to C from C+

Expand|Select|Wrap|Line Numbers
  1. # include <stdio>
  2.  
  3. int main()
  4. {
  5. //variables
  6.     float famount;
  7.     float ftax;
  8.     float sale;
  9.     int choice;
  10.     for(;;)
  11.  
  12.         printf("Please input the purchase amount :");
  13.         scanf("%f",&famount);
  14.              //check for valid input
  15.     if (famount>0)
  16.  
  17.  
  18.     printf("Invalid value");
  19.  
  20.     for(;;)
  21.     {
  22.         printf"Please select which store to use for the tax calculation "<<endl;
  23.         printf("1- Del Mar ");
  24.         printf("2- Encinitas"); 
  25.         printf("3- La Jolla ");
  26.         scanf("%;f");
  27.         if(choice>3||choice<1)
  28.             printf("Invalid value"); //output
  29.         else 
  30.             break;
  31.     }
  32.     switch(choice)
  33.     {
  34.     case 1:
  35.         tax=0.0725;
  36.         break;
  37.     case 2:
  38.         tax=0.075;
  39.         break;
  40.     case 3:
  41.         tax=0.0775;
  42.         break;
  43.     }
  44.     tax=tax*amount;
  45.     sale=amount+tax;
  46.     printf("Amount\tStore\t\tTax\tTotal sale");
  47.     cout<<fixed<<setprecision(2);
  48.     cout<<amount<<"\t";
  49.     switch(choice)
  50.     {
  51.     case 1:
  52.         printf("Del Mar ");
  53.         break;
  54.     case 2:
  55.         printf("Encinitas");
  56.         break;
  57.     case 3:
  58.         printf("La Jolla ");
  59.         break;
  60.     }
  61.     printf("\tTax\t");//sales with tx
  62.     return 0;
  63. }
Oct 31 '06 #1
1 1664
Banfa
9,065 Expert Mod 8TB
You haven't said what the problem is.
Oct 31 '06 #2

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

Similar topics

6
by: Newbee Adam | last post by:
I have been reading in help how I need to use decimal becuase currency does not exist like I used in vb6. I had a difficult time on google and msdn finding how or if I can take the value of text...
2
by: Megat | last post by:
I'm trying to create a conversion program, that convert a simple proprietry programming language to an international standard languange, using Visual C++. Need some help from those who has...
8
by: prabha | last post by:
Hello Everybody, I have to conert the word doc to multiple html files,according to the templates in the word doc. I had converted the word to xml.Also through Exsl ,had finished the multiple...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
5
by: Unforgiven | last post by:
I downloaded a web timer control from http://www.eggheadcafe.com/articles/20021006.asp and it's written in C#. The code and .DLL comes with the download so I'm trying to convert the sample which...
27
by: sam_cit | last post by:
Hi, I needed help in converting a character to the correspoding hexadecimal values, like the following example, ASCII value : ABC Hex Code Value : %41%42%43... whats the logic of conversion...
1
by: Learner | last post by:
Hello Friends, I need help converting the below C# code snippet to vb.net. case "CreationDate": comparison = new Comparison<MembershipUserWrapper>( delegate(MembershipUserWrapper lhs,...
16
by: manmit.walia | last post by:
Hello All, I have tried multiple online tools to convert an VB6 (bas) file to VB.NET file and no luck. I was hoping that someone could help me covert this. I am new to the .NET world and still...
10
by: Hank Stalica | last post by:
I'm having this weird problem where my code does the following conversion from string to float: 27000000.0 -27000000.00 2973999.99 -29740000.00 2989999.13 -2989999.25 The number on the left...
6
by: gsBytes | last post by:
I am working with a specialized graph class, which has a node class and an edge class. In the node class, there is a list of pointers to each edge. Code that uses the graph must be able to see what...
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?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.