m1_p1-skeleton_variables_and_io (1).pptx
Document Details
Uploaded by WellRoundedOlivine
Tags
Related
Full Transcript
CSE 1321 Module 1 – Part 1 A programming Primer Topics Skeletons What are they? What skeletons exist? Printing to the screen Variables Identifiers Conventions Reading user input Skeletons Skeleton programs: 1. Are the smallest program you can write 2. Are the minimal amo...
CSE 1321 Module 1 – Part 1 A programming Primer Topics Skeletons What are they? What skeletons exist? Printing to the screen Variables Identifiers Conventions Reading user input Skeletons Skeleton programs: 1. Are the smallest program you can write 2. Are the minimal amount of code that compiles 3. Do NOTHING 4. Define the entry/starting point of the program 5. Are something you should memorize You probably won’t understand what you’re about to see… and it’s OK! Skeletons BEGIN MAIN END MAIN Note: every time you BEGIN something, you must END it! Write them as pairs! Ps Skeletons using System; class MainClass { public static void Main (string[] args) { } } Note: The opening “{“ means BEGIN and the closing “}” means END Skeletons #include int main () { return 0; } Again note: The opening “{“ means BEGIN and the closing “}” means END Skeletons class MainClass { public static void main (String[] args) { } } Note: Capitalization matters! Skeletons if __name__ == “__main__”: pass Python can technically run on an empty skeleton, but we will use this as a skeleton as a good practice Lesson #1: Learned All of them contain main, which is the entry/starting point of the program Printing to the Screen BEGIN MAIN PRINTLINE “Hello, World!” PRINT “Bob” + “ was” + “ here” END MAIN Ps Printing to the Screen using System; class MainClass { public static void Main (string[] args) { Console.WriteLine ("Hello, World!"); Console.Write ("Bob"+" was"+" here."); } } Note: There’s also a Console.Write() Printing to the Screen #include using namespace std; int main () { cout