Day 1(3/10/07)
Introduction
Today, I had my first class of C++ programming. We learned many things about the art of this programming.
We used the program Windows Visual Studio 2003. There are many other programs for this. This is simply what we had.
So once we start the program we have to open a select a Win32 file and make it a C++ file. Then in the options we make this file empty project so it does not
come with anything unneccesary. Now once these steps are completed we are ready to start typing our program. The first thing you must type are things that let your project have outside information.
#include<stdio.h>
#include<stdlib.h>
#include<time.h>(on occasions)
Then the next step usually in a program is to define variables. We can do this with a %i or %c. Also after every statement you must end with ;. It's sort of like a period in English class. Then Scanf(not the best way) allows the user to type something into the program.
Once the user types it in you can make your program display an appropriate response for this with the if(Whatever). Also if a word gets highlighted blue by itself in this program that means
the program understands what these mean. When you see these your usually on the right track.
Also it's very important to but{} surrounding your conditions.
Other conditions are == which sets conditions equal and != which sets them inequal. Also there are > and < conditions.
To run your program you debug it which means you go through it
This is what has been applied by myself today in C++ class to make a number guessing game which gave difficulty and feedback.
See page two for next class
Day 2(3/17/07)
Today was our second class of C++. We firast made a game that counted. Mr. Steele told us to put all the numbers in using programming which is
known as brute force. Obviously this got a bit tedious so Mr. Steele taught us a loop.
There are two types of loops.
A loop and a for loop.
A regular loop is While(1).
These allow you to repeat processes using logical statements to set limits and flexibility.
Also we learned more conditions today.
else()
else if()
We also learned that or can be symbolized as ||.
gets()
this is a subsitute for scanf and means get string.
Using this allows us to get decimals as well.
In class today we used this information to make a blackjack game.
Day 3(3/24/07)
Today we continued our Blackjack program. Today was mostly worked and we did not learn as many new concepts as we did in the first day.
However, I myself learned alot about different kinds of errors and how to fix them.
"Undeclared identifier means you probably are mssing a ; at the end of a statement somewhere or you forgot to declare a variable"
Identifier not found usually means that you forgot to use brackets.
Fatal errors occur many times and can be simply solved by restarting the program.
Illegal escape sequence usually means you've done something wrong with the brackets or semicolons.
Defintions are illegal probably says that you did not define your variable in the correct syntax procedure
These are the common errors in the programming and what they mean.
We also learned that s(rand) gives us a semi random number based on a program. A number can never be totally random.
Also we learned how to use global variable which are common variables used by all programmers.
Day 4(3/31/07)
Today we completed our Blackjack program. The program was very tedious and required much of what we learned in C++.
We did not learn too much today but I have a few tips for future C++ programmers
1.Build your program regularly, do not go 1/4 way into the program and find 50 errors and don't know what to do.
2. Always think logically, once you learned C++ language everything is logical .
Also make sure when making your program to always declare variables once you make them or you will run into problems.
Programming is a shortcut to many things. Here is an example. This a grade calculating calculator with a weight of 25% per test and 10% per hw
#include
<stdio.h>
#include
<stdlib.h>
void
{
printf("what is your name in 3 letters(This is for your grade)\n");
scanf("%c%c%c%c",&first_letter,&second_letter,&third_letter,&throw_away);
printf("what did you get on your first test out of a 100\n");
scanf("%i%c",&test_1,&throw_away);
printf("what did you get on your second test out of a 100\n");
scanf("%i%c",&test_2,&throw_away);
printf("What score did you receive on your first homework assignment\n");
scanf("%i%c",&hw_1,&throw_away);
printf("What score did you receive on your second homework assignment\n");
scanf("%i%c",&hw_2,&throw_away);
printf("What score did you receive on your third homework assignment\n");
scanf("%i%c",&hw_3,&throw_away);
printf("What score did you receive on your fourth homework assignment\n");
scanf("%i%c",&hw_4,&throw_away);
printf("What score did you receive on your fifth homework assignment\n");
scanf("%i%c",&hw_5,&throw_away);
test_a = ((test_1 + test_2)/2);
hw_a = ((hw_1 + hw_2 + hw_3 + hw_4 + hw_5)/5);
grade = ((test_a + hw_a)/2);
printf("your grade is: ");
printf("%i",grade);
printf("\n");
{
printf("You have received an A");
}
{
printf("You have received a B");
}
{
printf("You have received a C");
}
{
printf("You have received a D");
}
{
printf("You have received an E");
}
{
}
.
Have fun with the art of C++ programming the possibilities are endless.
Written by Sudheer Dhoop
main()int test_1=0;int test_2=0;int test_a=0;int hw_1=0;int hw_2=0;int hw_3=0;int hw_4=0;int hw_5=0;int hw_a=0;int grade=0;char throw_away;char first_letter;char second_letter;char third_letter;if( grade > 89)elseif( grade > 79)elseif( grade > 69)elseif( grade > 59)elseif( grade < 60)else(grade == 0);while(1);
Comments (0)
You don't have permission to comment on this page.