Free Essay

English

In:

Submitted By saher123
Words 714
Pages 3
Introduction to Programming with C#

Variable Types & Initialising Variables

Introduction to Variables

A variable is a storage location that holds a value. You can think of a variable as a box in the computer’s memory holding temporary information. You must give each variable in a program an unambiguous name that uniquely identifies it in the context in which it is used. You use a variable’s name to refer to the value it holds. For example, if you want to store the value of the cost of an item in a store, you might create a variable simply called cost and store the item’s cost in this variable. Later on, if you refer to the cost variable, the value retrieved will be the item’s cost that you stored there earlier.

Working with Primitive Data Types

C# has a number of built-in types called primitive data types. The following table lists the most commonly used primitive data types in C# and the range of values that you can store in each.

|Type |Description |Size (in bits) |Range |
|int |Whole numbers |32 |-2147483648 to 2147483647 |
|long |Whole numbers (larger range than int |64 |-9223372036854775808 to 9223372036854775807 |
| |data type) | | |
|float |Floating point numbers |32 |7 digits |
|double |Double precision |64 |15-16 digits |
| |(more accurate than float type) | | |
|decimal |Monetary values |128 |28-29 decimal places |
|string |Sequence of characters |16 bits per character |Not applicable |
|char | |16 |0 to 65535 |
|bool |Boolean |8 |True or False |

Naming Variables

You should adopt a naming convention for variables that helps you avoid confusion concerning the variables you have defined. The following list contains some general recommendations:

• Don’t start an identifier with an underscore. • Don’t create identifiers that differ only by case. For example, do not create one variable named myVariable and another named MyVariable for use at the same time because it is too easy to get them confused. • Start the name with a lowercase letter. • In a multiword identifier, start the second and each subsequent word with an uppercase letter. (This is called camelCase notation.)

Important You should treat the first two of these recommendations as compulsory because they relate to Common Language Specification (CLS) compliance. If you want to write programs that can interoperate with other languages, such as Microsoft Visual Basic, you must comply with these recommendations.

For example, score, footballTeam, _score, and FootballTeam are all valid variable names, but only the first two are recommended.

Declaring Variables

Variables hold values. C# has many different types of values that it can store and process — integers, floating-point numbers, and strings of characters, to name three. When you declare a variable, you must specify the type of data it will hold.

You declare the type and name of a variable in a declaration statement. For example, the following statement declares that the variable named age holds int (integer) values. As always, the statement must be terminated with a semicolon.

int age;

The variable type int is the name of one of the primitive C# types, integer, which is a whole number.

After you’ve declared your variable, you can assign it a value. The following statement assigns age the value 42. Again, you’ll see that the semicolon is required.

age = 42;

The equal sign (=) is the assignment operator, which assigns the value on its right to the variable on its left. After this assignment, the age variable can be used in your code to refer to the value it holds. The next statement writes the value of the age variable, 42, to the console:
Console.WriteLine(age);

Task

Open C# and enter the following code and run it.

|Program Code |
| |
|using System; |
|using System.Collections.Generic; |
|using System.Linq; |
|using System.Text; |
| |
|namespace ConsoleApplication1 |
|{ |
|class Program |
|{ |
|static void Main(string[] args) |
|{ |
| |
|[pic] |
|} |
| |
| |
|} |
|} |

Remember to save your finished program.
Task

1. Create a program that asks the user to enter their name, first line of their address, town, county, post code and prints out the following message

Welcome {username}, you live at: first line of their address town county post code

2. Create a program that asks the user to enter their title (Mr, Mrs etc), firstname, their initial, their lastname, favourite colour, favourite band and prints out the information into a message of your choice.

Similar Documents

Free Essay

English

...“English should not become official” America is a country filled with many people with different language trying to get along. We live in a society made up and founded by immigrants. Looking at our society today, English shouldn’t become the official language of the U.S because, first of all it is unfair for others living here who have English as a second language or can speak little English. Second of all, it will limit certain people when it comes to finding a job because not everybody is capable of speaking, reading, or writing the English language correctly. Finally, it violates the terms our country was built on. If English becomes the official language of the U.S, people with English as a second language or with little English are put at a disadvantage. It’s a fact that our society is largely made of immigrants. Moreover, children who will be born in the U.S won’t be able to learn their parent’s native language. So it wouldn’t make any sense from the government to limit them because the government will need bilingual people. We take pride in our diversity, so when we limit our diversity, we put people here at a disadvantage. Additionally, there are certain people who don’t dedicate themselves to learn the English language. The reason is because they get employed by businesses that practice the same language. For instance, lots of Spanish immigrants only get to work in the Spanish community. Spanish is very much used in the United States, because they don’t develop any...

Words: 455 - Pages: 2

Free Essay

English

...ourselves by only speaking English?” Will Hutton clarity how he think it´s important for the individual person and the English people to learn more than the language, which are their native language. He talk about how it´s important to speak a foreign language, especially to save the Britain´s future economic. By comparing England and America where he see same “xenophobia” culture, he indicate why American can have their attitude to foreign language while they can´t, like it´s saying in the text. In addition will Hutton see this as a lost interest in other countries from the youth, he discuss how that fact establish this unwillingness. The second text by David Hughes “Do we really need foreign language skills to flourish?” David Hughes thinks that the fluency in foreign language is a benefit for anyone, but he doesn´t see the importance in that, when the rest of the world is learning English. When David Hughes went to the Far East, he heard English spoken everywhere, and as he wrote it in the text. The third text by Susan Purcell “Saying Britons ´don’t do´ languages is a fallacy” explain why the discussion about the English language skills is far more nuances. Susan Purcell is comparing the text to the EU-countries with England. She is talking about how the other European Union countries compare their language and how English is the mandatory first foreign language in 13 of the EU´s member states. Over 90 % of children in European countries ‘schools learn English, like is saying in...

Words: 419 - Pages: 2

Premium Essay

English

...English should continue to be the official language of India. English is used as the official language in India. Yes • English is one such language that is understood by people from different castes and states, and therefore deserves to be the official language of India. • If any other language is tried to make the official language, all the regional parties will start the battle of making the state level as official language of India. • If Hindi is given priority then it will create differences among the people who don’t speak it making them feel as second class citizens. • Region C forms an important part of India that got agitated when PM Modi used Hindi for its diplomatic talks.  • The use of English language is as per the requirement of being a part of globalization and there is nothing wrong in it. No • Forget about all the different castes and religions as Indians have their own national language that is Hindi, and that should only be the official language of India. • It is the duty of the government to take the measures so that people all over in India can read, write and speak in Hindi.  • Already Indian has adopted the western culture in many ways. If it continues there will be no personal or rather say national identity of India. • In this case, India should learn something from Pakistan who made the Urdu as their official language after the division of country. • The small little steps are the ways that will make sure that the...

Words: 404 - Pages: 2

Free Essay

English

...COMPULSORY SUBJECT ENGLISH (801) Aims (English Language) To develop the ability to: • • • derive, infer and critically assess information through listening. express oneself by speaking individually, or in a discussion. read with comprehension drawing information directly or by inference from the text, through an understanding of grammar and structure, vocabulary and idiom. employ a variety of skills in writing : within a framework, using argument or imagination or note making and summarizing. • • use the English language for the purpose of study and social and cultural interaction. speak and write clearly and to the purpose, using appropriate grammar, vocabulary and idiom. Aims (Prescribed Texts) 1. To enjoy and appreciate literature through a critical study of selected literary works. 2. Through the study of literature: • • • approach an understanding of humanity. develop an interest in the thought and culture of the peoples of the world. develop the power of expression and a sense of aesthetic values. • CLASSES XI & XII There will be two papers as follows: Paper 1: English Language (3 hours) – 100 marks Paper 2: Prescribed Textbooks (3 hours) – 100 marks Paper 1: English Language (3 hours) Question One: A composition on one of a number of subjects. ...30 Marks Question Two: Directed writing (an article, a book/film review, speech and report writing or personal profile) based on suggested points...20 Marks Question Three: Short-answer questions to test grammar, structure...

Words: 1055 - Pages: 5

Premium Essay

English

...Assignment 1: The Story of English "A English Speaking World" English as a world language has developed through different periods of time and in different places. English was and is still spoken in great numbers in countries across the world. English has branched out into different dialects, with slang included especially in the American form of English. English also bears a sort of social class, where those who speak English have a certain upper class appearance. It also creates a common language which helps business, economies and people connect better. It has become a dominant language and serves as a lingua franca for the world. The popularity of English has allowed the world to communicate at a higher efficiency when compared to a world with no dominate language. But his plan did not work and India along with China has seen an ever increasing number of people learning and speaking English. The popularity and necessity of English is seen in India government systems and everyday life. India's civil system is predominantly in English rather than Hindi. Out of 137 typist at a civil court, only one types in Hindi while the rest in English. This is necessary for smooth transactions to occur in India's systems, which we have seen from examples in class. Without a lingua franca, communication between India's different regions would be very difficult. In India there are 14 different variations of Hindi, with English as a common language miscommunication is less...

Words: 367 - Pages: 2

Free Essay

English

...Anyone who reads Old and Middle English literary texts will be familiar with the mid-brown volumes of the EETS, with the symbol of Alfred's jewel embossed on the front cover. Most of the works attributed to King Alfred or to Aelfric, along with some of those by bishop Wulfstan and much anonymous prose and verse from the pre-Conquest period, are to be found within the Society's three series; all of the surviving medieval drama, most of the Middle English romances, much religious and secular prose and verse including the English works of John Gower, Thomas Hoccleve and most of Caxton's prints all find their place in the publications. Without EETS editions, study of medieval English texts would hardly be possible. As its name states, EETS was begun as a 'club', and it retains certain features of that even now. It has no physical location, or even office, no paid staff or editors, but books in the Original Series are published in the first place to satisfy subscriptions paid by individuals or institutions. This means that there is need for a regular sequence of new editions, normally one or two per year; achieving that sequence can pose problems for the Editorial Secretary, who may have too few or too many texts ready for publication at any one time. Details on a separate sheet explain how individual (but not institutional) members can choose to take certain back volumes in place of the newly published volumes against their subscriptions. On the same sheet are given details about...

Words: 1121 - Pages: 5

Premium Essay

English

...Pronunciation Schwa Schwa is the most common sound in the English language. It occurs only in unstressed syllables and getting it correct helps spoken English to sound more natural and fluent. Any vowel letter can be pronounced as schwa and the pronunciation of a vowel letter can change depending on whether the syllable in which it occurs is stressed or not. The phonemic symbol for schwa is: /e/ Following are two exercises to help students develop their awareness of schwa. The audio examples from the exercises can be downloaded from www.bbclearninglish.com Pronunciation Schwa Exercise 1 Look at the words below and decide where in the word the schwa sound occurs. Underline and/or write the schwa symbol over the correct part of the word. The first one has been done for you. Hint: One word has two examples of schwa. All the others have only one. docto r banana difficult to mo rro w s u mme r le ve l prote ct survive pupil the atre me a s u re w izard Pronunciation Schwa © BBC Learning English bbclearningenglish.com Pronunciation Schwa Exercise 2 In this exercise, look at these sentences and decide where the schwa sound occurs. It may occur more than once in each sentence. The minimum number of schwas in a sentence is 1, the maximum 7. 1. It’s for y ou /e/ 2. 3. 4. 5. 6. 7. It tak es a lot of time How about a cup of tea? What are y ou doing tonight? What time will y ou arriv e at V ictoria? I was going...

Words: 529 - Pages: 3

Premium Essay

English

...JEJEMON research paper by John Andrew Samonte * by diyubaku, Oct 10, 2010, 10:42:48 PM * Journals / Personal iii Table of Contents Title Page............................................................................................i Acknowledgement......................................................................ii Table of Contens......................................................................................iii Chapter I....................................................................................1 Introduction and Background of the story.........................1 Significance of the Study..................................................3 Scope and Limitations......................................................5 Chapter II................................................................................... Research Problem.................................................................................8 Effects..................................................................................................10                                                                                                                                                                          ii Acknowledgement  “You learn to speak by speaking, to study by studying, to run by running, to work by working; in just the same way, you learn to love by loving.” I  would  like  to  express my sincerest thanks to those special persons  who  made  my  life  so meaningful...

Words: 4253 - Pages: 18

Premium Essay

English

...Mat Clark – IELTS Speaking LỜI NÓI ĐẦU Chào các bạn, xuất phát từ nhu cầu bản thân muốn học môn speaking cho bài thi tiếng anh IELTS, chúng tôi nhận thấy cuốn sách này có giá trị rất tốt cho việc tham khảo. Tuy nhiên, các bản sách điện tử đang tràn lan trên mạng Internet hiện nay có chất lượng rất thấp, kèm theo đó là việc có thêm tiếng Trung dẫn tới lãng phí về giấy in, tiền bạc, thời gian. Hiện nay, cuốn này này đã được một nhà xuất bản tại Việt Nam mua lại bản quyền từ tác giả Mat Clark, và đã xuất bản tại Việt Nam, chúng tôi khuyên các bạn nên mua cuốn sách này để sử dụng, nhằm tôn trọng giá trị của cuốn sách này, cũng như tôn trọng tác quyền của tác giả cũng như nhà xuất bản. Chúng tôi gõ lại cuốn sách này nhằm mục đích duy nhất là để học tập, nghiên cứu, không hề mang bất cứ mục đích kinh doanh nào. Mọi hành động thương mại liên quan tới bản gõ lại này là không hề liên quan tới chúng tôi. Mong các bạn tôn trọng tác giả và tôn trọng ý muốn của chúng tôi. Trong quá trình gõ và biên tập, do trình độ không chuyên, không thể tránh khỏi có sai sót. Xin cảm ơn, chúc các bạn học tốt. 1 Mat Clark – IELTS Speaking IELTS SPEAKING – MAT CLARK Preface During my 5 years as an IELTS examiner in China, I have seen thousands of Chinese IELTS candidates perform OK in the speaking interview. Most people would agree that an OK score in speaking is 5 or 6. Many students now realize that a score of 5 or 6 for speaking is not enough for their study requirements...

Words: 50246 - Pages: 201

Premium Essay

The Importance Of English In English

...survey with a questionnaire divided into two sections, first one is for the English teachers and another one is for the students, it's...

Words: 925 - Pages: 4

Premium Essay

English

...I Acknowledgement For many of us, the state of education in a country speaks volumes. Where English is spoken and taught as a second language, fluency is deemed a basic requirement for proper communication and propagation of ideas and connotes success. Does this fluency actually translate to a country's economic success and overall standing in the world of nations? The reason why we came up with this topic is to test the capability of a certain number of people when it comes to proficiency in English, not just to test but to give some idea what is the importance of being proficient in English and how can it help us. English language is and has always been one of the most popular languages spoken, written & followed all over the globe. No matter in which part of the world you choose to go, command over this language enables you to communicate with others regardless of what their national language would be. Therefore it becomes not only important but compulsory to master this art & implement it in the real life. This course is designed to clear concepts, renew basics and to professionally prepare you for real life communication at all levels. · Background of the study English has been considered as international language and also for studying use English as official language. Proficiency in English includes capability to read and understand the language and the way words are pronounced as well as the sense in which word are used (though variations in usage is identified...

Words: 2221 - Pages: 9

Premium Essay

English

...English as Official Language of United States of America The English language is originated from the Germanic tribes language, which has its roots from England in the form of Old English also known as Anglo-Saxon and has evolved into todays Modern English as we know it. English has become one of the most spoken languages in world, and is ranked as the second most spoken language. English should be the official language of the United States of America. Considered as an international language, it is the most learned and studied language throughout the world. United States laws prohibit the use of any other languages other then English on military installation or in Department of Defense buildings when conducting official business. These are just two reason of why I believe English should be the official language of the United States. In the United States, there are approximately 300 languages other than English that are spoken at home. English should be made the official language of the United States because it will knock down the language barriers for immigrants and they will be more likely to prosper in this nation, even though this may be a difficult process to accomplish at first, for many poor immigrants. In New York City, New York there are approximately thirty-five household languages other then English. If each of these subcultures of New York City have no common language, then it would create over thirty-five separate cities unable to prosper as one. Being required...

Words: 802 - Pages: 4

Premium Essay

English

...English y the largest language by number of words; the Oxford English Dictionary lists 500,000 words, not including technical and scientific terms.[18][19] Contents [hide] * 1 Significance * 2 History * 3 Classification and related languages * 4 Geographical distribution * 4.1 Countries in order of total speakers * 4.2 Countries where English is a major language * 4.3 English as a global language * 4.4 Dialects and regional varieties * 4.5 Constructed varieties of English * 5 Phonology * 5.1 Vowels * 5.1.1 Notes * 5.2 Consonants * 5.2.1 Notes * 5.2.2 Voicing and aspiration * 5.3 Supra-segmental features * 5.3.1 Tone groups * 5.3.2 Characteristics of intonation—stress * 6 Grammar * 7 Vocabulary * 7.1 Number of words in English * 7.2 Word origins * 7.2.1 Dutch and Low German origins * 7.2.2 French origins * 8 Writing system * 8.1 Basic sound-letter correspondence * 8.2 Written accents * 9 Formal written English * 10 Basic and simplified versions * 11 See also * 12 References * 12.1 Notes * 12.2 Bibliography * 13 External links | [edit] Significance See also: English-speaking world and Anglosphere Modern English, sometimes described as the first global lingua franca,[20][21] is the dominant...

Words: 898 - Pages: 4

Premium Essay

English

...English is a West Germanic language that was first spoken in early medieval England and is now a global lingua franca.[4][5] It is spoken as a first language by the majority populations of several sovereign states, including the United Kingdom, the United States, Canada, Australia, Ireland, New Zealand and a number of Caribbean nations; and it is an official language of almost 60 sovereign states. It is the third-most-common native language in the world, after Mandarin Chinese and Spanish.[6] It is widely learned as a second language and is an official language of the European Union, many Commonwealth countries and the United Nations, as well as in many world organisations. English arose in the Anglo-Saxon kingdoms of England and what is now southeast Scotland. Following the extensive influence of England, Great Britain, and the United Kingdom from the 17th to mid-20th centuries through the British Empire, it has been widely propagated around the world.[7][8][9][10] Through the spread of American-dominated media and technology,[11] English has become the leading language of international discourse and the lingua franca in many regions.[12][13] Historically, English originated from the fusion of closely related dialects, now collectively termed Old English, which were brought to the eastern coast of Great Britain by Germanic settlers (Anglo-Saxons) by the 5th century; the word English is simply the modern spelling of englisc, the name of the Angles[14] and Saxons for their...

Words: 497 - Pages: 2

Free Essay

English

...Should English be made the official language of India? Well, although English is a global language and it has somewhat become necessary to know English if one has to be successful globally, still making it our country’s official language makes little sense to me. If the whole point of changing our official language is related to the growth and success of our nation then China and its growth should make no sense to the world. The leader in BRIC nations and the nation considered next ‘SUPERPOWER’ after America doesn’t have English as their official language. They are doing great with mandarin and have very less people speaking English there. When their language is not posing a hindrance to their growth, when their GDP rate is going pretty well, when they are not thinking for changing their official language but are rather putting their heads into bigger constructive discussions then why should we? Globalization has brought the world closer and therefore to know and have tolerance for different cultures and languages is absolutely great but to forget and bring a change in our own heritage is something that according to me should not be acceptable. It’s fantastic to know English and get education in the same medium. Surely, it enhances our people to be recognized globally. It may bring them confidence and it may also aid to their growth in personality, but to look down upon one’s own culture and language is like looking down upon your parents when they are old and they need help...

Words: 285 - Pages: 2