Something We Should Know

Something We Should Know

Something we should know 1. Hw is due next Wednesday 8/31/2011 by 8:00 a.m. Assignments submitted after the due date and time, but within 24 hours, will be assessed a 20% penalty. No assignments will be accepted more than 24 hours after the due date and time. (If you do really have some reason, for example, illness and crash on your computer, talk directly to professor. Because I really have to ask him for approval again.) 2. Lab score is 10 of overall 100 including attendance and participation. Attendance 12 11-10 9-8 7-6 5-4 3-2 Lab score 10 9 8 7 6 5 Active participations such as asking questions, point out my mistakes will make up some score lost from absence. But total lab score does not exceed 10. 3. Initial your name on the list each lab, otherwise, I will not know you attend. 4. I am not native speaker and not good listener, we really can learn from each other 1. Downloading DevC++ • 1.Download Dev C++ and work on your computer http://www.cs.uic.edu/~i109/TA/software.html • Dev C++ seems to be only available on Windows platform. If you really want to write C++ code in Mac, you can find Kaiser for help. • Dev C++Version has been abandoned but there are excellent alternative IDEs for Linux, such as KDevelop and Anjuta. • I recommend you use Dev C++, so that we have more in common. • Other IDE such as Microsoft Visual Studio is not recommended, because it doesn’t strictly follow C++ standards while Dev C++ does. That means codes run correctly might not run correctly on Dev C++. And we TAs are grading using Dev C++ 2. Project vs. file • Project may contains a collection of .cpp files, .h files and other resources like image, sounds, DLL files, etc • Both project and file are OK, since our course is relatively easy. But for convenience please only hand in .cpp file and the documentation file. • A more easier way (but bad habbit) is to simple create a file xyz.cpp and double click it. *file extension, let’s google it] 3.First program: HelloWorld 1. /* 2. Huayi Li 3. UIN: 12345678 4. Date: 2011-8-25 22:08:28 5. other information about the program 6. */ 7. #include <iostream> // to include the input and output library 8. using namespace std; // namespace indication, because cout is inside std, 9. // using this statement we can use cout instead of std::cout 10. int main(){ 11. cout<<"Hello"; 12. cout<<" World"<<endl; // break to a new line 13. system("pause"); // windows (Dev C++ ) user need to add this, 14. return 0; // error code, 0 means returning normally 15. } 4. Try it on your computer • compile run • .cpp ------------> .exe ------> application you see • A tricky thing of Dev C++ • xyz.cpp[old]----->xyz.exe[old] • xyz.cpp[new], if you modifies source file and run without compile, the actual program you run is the old version 5. Console Application and Windows Application • The text-only interface of Console Application is a black screen through which user interacts with computer by keyboard as input and console as output 6. Second program dealing with input and output 1. #include<iostream> 2. using namespace std; 3. int main(){ 4. double length,area; 5. cout<<"input the length of a side of a square:"<<endl; 6. cin>>length; 7. cout<<"you have entered a number "<< length <<endl; 8. area = length * length; 9. cout<<"the area of the square is"<< area <<endl; 10. system("pause"); 11. return 0; 12. } 7. Swap value--- basic technique of programming • a=1, b=2 • Introduces a new variable t (temporary) • t=a; a=1,b=2, t=1 • a=b; a=2, b=2, t=1 • b=t; a=2, b=1, t=1 7. Swap value--- basic technique of programming (cont’d) • #include<iostream> • using namespace std; • int main(){ • int a = 1, b = 2; • int t; • cout<<"before swapping a="<<a<<" b="<<b<<endl; • t=a; • a=b; • b=t; • cout<<"after swapping a="<<a<<" b="<<b<<endl; • • system("pause"); • return 0; • } 8. How to use blackboard to submit • Hope everyone can submit in this format FirstName_LastName_HW1.cpp FirstName_LastName_HW1_document.txt Or package them into one file called FirstName_LastName_HW1.zip • Log in blackboard -> Assignment (left panel) • -> HW1 (in this demo we use Lab Assignment 0) -> 2. Assignment materials -> Attach File browse for Local file -> [add another one if necessary] -> [write some comments, better not] ->submit • ->check it (some tricky thing about Blackboard again, blackboard may not allow you to submit multiple files).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us