![]() |
![]() |
Home Appotography.com |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
![]() |
![]() |
![]() |
|
![]() |
|||
![]() |
#1 |
Senior Member
![]() Joined: Jan 2002
Location: Great White North
Posts: 1,582
![]() |
My First Program!
I'm really excited! We just started C, C++ and I got to write my first program. It's nothing too exciting but to me it's step one in a cool direction.
![]() /*My first program Author: Andrew Gregory Date: Feb 19 2002 Purpose of program: To learn how */ #include <stdio.h> main() { int integer1, integer2, sum; printf("Enter first integer\n"); scanf("%d", &integer1); printf("Enter second integer\n"); scanf("%d", &integer2); sum = integer1 + integer2; printf("sum is %d\n", sum); return 0; } |
![]() |
![]() |
![]() |
#2 |
ShakeandBakeMasta!
![]() Joined: Jan 2002
Location: The hole in the bottom of the sea
Age: 38
Posts: 742
![]() |
eek...err..what does it teach you how to do lol?!
|
![]() |
![]() |
![]() |
#3 |
Senior Member
![]() Joined: Jan 2002
Location: Great White North
Posts: 1,582
![]() |
Well the program just adds a couple numbers. Thats it. The "To learn how" documentation was just filling in stuff that my teacher wanted. I could have put anything there.
Last edited by Sleazy P Martini; Feb 19th, 2002 at 11:35 PM.. |
![]() |
![]() |
![]() |
#4 |
ShakeandBakeMasta!
![]() Joined: Jan 2002
Location: The hole in the bottom of the sea
Age: 38
Posts: 742
![]() |
ah...i see...hmm one of these days im going to get into 3d stuff and make some characters for some games, and ill mail em to you if you want em...and that has nothing to do with the thread..Oops
![]() |
![]() |
![]() |
![]() |
#5 |
Banned Member
![]() Joined: Jan 2002
Posts: 163
![]() |
Congratulations Sleazy!
![]() Now that we're on the topic however, I just made this one: #include <iostream> #include <string> using namespace std; // Example of using the generic algos of find and replace bool replace ( string &s, const char * find_str, const char * rep_str ) { unsigned int i = 0; if (( i=s.find(find_str)) != s.npos) { s.replace(i, strlen(find_str), rep_str); return (true); } return(false); } void String_Test ( void ) { // Create instance of a string from literal string string s = "Hello World"; // Output of the string in various ways cout << "s.c_str() = " << s.c_str() << endl; cout << "s.data() = " << s.data() << endl; cout << "s = " << s << endl; cout << "sizeof(s) = " << sizeof(s) << endl; cout << "s.size = " << s.size() << endl; cout << "s.length = " << s.length() << endl; cout << "s.capacity = " << s.capacity() << endl; cout << "s.max_size = " << s.max_size() << endl; // output by single char int len = s.length(); cout << "s[0]-s[" << len << "] = "; for ( int i=0; i<len; i++ ) { cout << s[i]; } cout << endl; // Creating a string string s2; // assignment to a string s2 = "Hello Mars and Venus"; // concatenate strings together string s3; s3 = s + " " + s2; cout << s3 << endl; // test for empty string cout << "s.empty() << " << s.empty() << endl; //create and empty string string s4; cout << "s4.empty() << " << s4.empty() << endl; //Inline replacement in the string, found string s5 = "Address: ADD_DATA"; cout << "s5 = " << s5 << endl; if ( replace(s5, "ADD_DATA", "212 Oak Lane") ) { cout << "s5 = " << s5 << endl; } //Inline replacement in the string, not found string s6 = "Address: ADD_DATA"; cout << "s6 = " << s6 << endl; if ( replace(s6, "XYZ", "212 Oak Lane") ) { cout << "s6 = " << s6 << endl; } else { cout << "s6 = " << "Not Found" << endl; } if ( s5 == s6 ) { cout << "s5 == s6 = true" << endl; } else { cout << "s5 == s6 = false" << endl; } string s7 = "Test"; string s8 = "test"; if ( s7 < s8 ) { cout << "Test < test= true" << endl; } else { cout << "Test < test= false" << endl; } } int main ( void ) { String_Test(); return(0); } It's not done, and there are some errors. :o |
![]() |
![]() |
![]() |
#6 |
Senior Member
![]() Joined: Jan 2002
Location: Great White North
Posts: 1,582
![]() |
Whoa! Whats that one do? I've only been exposed to C for one day so that looks confusing to me.
|
![]() |
![]() |
![]() |
#7 |
Banned Member
![]() Joined: Jan 2002
Posts: 163
![]() |
It's just a command for processors. It's not confusing, you'll get it once you get to Alogarithms.
|
![]() |
![]() |
![]() |
#8 |
Senior Member
![]() Joined: Jan 2002
Location: Great White North
Posts: 1,582
![]() |
I am having big time trouble with Algorithms. I just don't know where to start. They give me a headache.
|
![]() |
![]() |
![]() |
#9 |
.red house.
![]() Joined: Jan 2002
Location: canada
Age: 38
Posts: 797
![]() |
Is anyone here familiar with logic circuits?
I'm working on things involving that in a high school class right now, and it's losing me. |
![]() |
![]() |
![]() |
#10 | |
Banned Member
![]() Joined: Jan 2002
Posts: 163
![]() |
Quote:
|
|
![]() |
![]() |
![]() |
Bookmarks |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Microsoft - Big Brother of the new millenium? | BlackThornn | General Chat | 9 | Aug 31st, 2002 10:11 PM |
Good Image Editing Program. | jbaseley | Help And Faq Forum | 15 | Aug 21st, 2002 06:02 PM |
Viruses | IcyMourdor | General Chat | 13 | Jun 13th, 2002 06:55 PM |
music program | Beretta55 | General Chat | 6 | Jun 3rd, 2002 11:12 AM |
how do i save a file into a gif and other files what program do i use plz URGENT | solidus-snake | Help And Faq Forum | 22 | Feb 11th, 2002 05:38 PM |
![]() |
![]() |
||
All times are GMT -5. The time now is 02:37 PM.
|
![]() |
|||
![]() |
![]() |
Ps2Fantasy.com | News | Games | Forums | Newsletter | Chat | Privacy Policy | Advertise With Us | Contact Us |
![]() |
![]() |
|||
Copyright ©2001-2014 MagnetiCat.com. All rights reserved. All trademarks and trade names are properties of their respective owners. | |||
![]() |
X vBulletin 3.8.10 Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|