i have written the following to explain to you some of the fundamental mistakes in your code, where they are wrong, and how you can learn from them and fix it. enjoy
lots wrong with that, but its easily fixed.
firstly, you need to learn about data types: the computer has different "keywords" which tell it how much space the specific data needs. you declared variables of type char, which is a data type pretty much specifically for characters, but you need to swave numbers. there is more than one data type designed to represent numbers: int, float and double. (to name the big 3)
let me firstly say that it should (hopefully) be perceptually obvious that to store a number like 2 in binary (as the computer does) should require much less space than storing a number like .00005157456575 (just for a ludicrously long example).
but that number is smaller than 2??? well it is, but its also much more precise than just 2 - therefore it will take more 1's and 0's in the computer to represent it.
without getting into memory specifics:
int is a data type designed to hold integers (i.e positive or negative whole numbers)
float is designed to store more detailed numbers, such as numbers accurate to a few decimal places
double is like float only there is more space allocated - more even more detailed (more decimal place) numbers.
the first thing you need to do is declare variables to hold all your numbers and names - there are a few rules. firstly, all your declarations should be at the very start of the program. secondly, variable names cant begin with numbers or symbols, but that doesnt mean they cant contain numbers and some symbols afterwards. thirdly, choose the type carefully.
declaring variables is the way that you tell the compiler to make some space in memory for a variable. the way it goes is to state the name of the data type, (int, char...), then give it a name. the name you assign it is how you will refer to that data later in your program. you had char 1 = Berlin and so on. as stated, the number must go, but another problem is that a char data type can only hold a single character - Berlin is 6 so that wont work.
later on you have a=0.725 and so on - this is illegal because when you try to compile, the computer will think that "a" is a variable, but you havent declared it in the manner described above for char, and thats a problem.
as you might be able to see by now, there is a lot you have to learn, so i'll point you in the right direction:
My problem is writing a C programming that displays some taxes
here's how you would declare the variables to store your tax rates:
Code:
float Berlin = 0.0725;
float Marlo = 0.075;
float Teymon = 0.0775;
int pur_amt = 125;
notice the variable names are related to the tax rates? that is sensible programming: you didnt need to declare variables of char for the city names - you can represent your information in a format like that. also note the choice of data types, and for pur_amt i used int since you don't have any decimal places. i could just as easily used float - and if i was later doing calculations involving pur_amt and one of the tax rates - i would have used float. that is a topic which i would recommend you find out about in the tutorial section of this site, i'm only writting this as a detailed description of your problem.
finally, you are ready to write to the screen - since you said that you want to learn by example, i have written this full program
Code:
#include <stdio.h>
int main ()
{
float Berlin = 0.0725;
float Marlo = 0.075;
float Teymon = 0.0775;
int pur_amt = 125;
printf ("The tax rate in Berlin is %f\n", Berlin);
printf ("The tax rate in Marlo is %f\n", Marlo);
printf ("The tax rate in Teymon is %f\n\n", Teymon);
printf ("The purchase price is the same in all: %d\n", pur_amt);
return 0;
}
this should really confuse you now! i won't explain it, but i will refer you to the tutorial section of this site - they have really great articles explaining very carefully from the basic which i outlined here. needless to say, once you understand what i wrote, you are not far away from writing real programs for yourself, just like the one above.
finally, as regards Miracle C, it was my first home compiler and i found it good to start out, and when you have learned more, you can graduate to a more detailed and powerful compiler which allows you to write more complex programs. miracle could suit you for up to a year or more, unless you're an avid programmer. then eventually you will need a change to something more reliable.
i hope this helps, and i'm sorry if you didn't want an explanation this detailed, but the truth is, you need to get the basics of declaring variables described to you. i hope this was clear enough to follow, here's a link to the tutorial section of the site
http://www.cprogramming.com/tutorial.html