Home  Appotography.com 
advertisement Tiny Crosswords - Made by MagnetiCatGames.com
Playstation 2 Fantasy - Everything about Playstation 2 Developed on Alienware! Search games!
  Register   Calendar   Members   FAQ   Home  

Latest NewsReviewsPreviewsFeaturesScreenshotsContact Our Staff

Welcome to the PsFantasy.com Forums.
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.



Go Back  PsFantasy.com Forums » General Forums » General Chat

Reply
 
Thread Tools
Old Feb 19th, 2002, 08:49 PM   #1
Sleazy P Martini
Senior Member
 
Sleazy P Martini's Avatar
 
Joined: Jan 2002
Location: Great White North
Posts: 1,582
Sleazy P Martini is on a distinguished road
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;
}
__________________
Sleazy P Martini is offline   Reply With Quote
Old Feb 19th, 2002, 09:26 PM   #2
BowevelJoe
ShakeandBakeMasta!
 
BowevelJoe's Avatar
 
Joined: Jan 2002
Location: The hole in the bottom of the sea
Age: 38
Posts: 742
BowevelJoe is on a distinguished road
eek...err..what does it teach you how to do lol?!
BowevelJoe is offline   Reply With Quote
Old Feb 19th, 2002, 09:52 PM   #3
Sleazy P Martini
Senior Member
 
Sleazy P Martini's Avatar
 
Joined: Jan 2002
Location: Great White North
Posts: 1,582
Sleazy P Martini is on a distinguished road
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..
Sleazy P Martini is offline   Reply With Quote
Old Feb 20th, 2002, 08:02 AM   #4
BowevelJoe
ShakeandBakeMasta!
 
BowevelJoe's Avatar
 
Joined: Jan 2002
Location: The hole in the bottom of the sea
Age: 38
Posts: 742
BowevelJoe is on a distinguished road
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
BowevelJoe is offline   Reply With Quote
Old Feb 20th, 2002, 08:57 AM   #5
LiquidSm0ke
Banned Member
 
Joined: Jan 2002
Posts: 163
LiquidSm0ke is on a distinguished road
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
LiquidSm0ke is offline   Reply With Quote
Old Feb 20th, 2002, 11:50 AM   #6
Sleazy P Martini
Senior Member
 
Sleazy P Martini's Avatar
 
Joined: Jan 2002
Location: Great White North
Posts: 1,582
Sleazy P Martini is on a distinguished road
Whoa! Whats that one do? I've only been exposed to C for one day so that looks confusing to me.
__________________
Sleazy P Martini is offline   Reply With Quote
Old Feb 20th, 2002, 01:17 PM   #7
LiquidSm0ke
Banned Member
 
Joined: Jan 2002
Posts: 163
LiquidSm0ke is on a distinguished road
It's just a command for processors. It's not confusing, you'll get it once you get to Alogarithms.
LiquidSm0ke is offline   Reply With Quote
Old Feb 20th, 2002, 02:18 PM   #8
Sleazy P Martini
Senior Member
 
Sleazy P Martini's Avatar
 
Joined: Jan 2002
Location: Great White North
Posts: 1,582
Sleazy P Martini is on a distinguished road
I am having big time trouble with Algorithms. I just don't know where to start. They give me a headache.
__________________
Sleazy P Martini is offline   Reply With Quote
Old Feb 20th, 2002, 06:39 PM   #9
Reid
.red house.
 
Reid's Avatar
 
Joined: Jan 2002
Location: canada
Age: 38
Posts: 797
Reid is on a distinguished road
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.
Reid is offline   Reply With Quote
Old Feb 20th, 2002, 08:53 PM   #10
LiquidSm0ke
Banned Member
 
Joined: Jan 2002
Posts: 163
LiquidSm0ke is on a distinguished road
Quote:
Originally posted by Sleazy P Martini
I am having big time trouble with Algorithms. I just don't know where to start. They give me a headache.
lol, I know what you mean, alogorithms suck.
LiquidSm0ke is offline   Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
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.


Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.

Playstation 2 Fantasy - Everything About Playstation 2 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
  • Page Generation 0.04963 seconds
  • Memory Usage 2,442KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (21)option
  • (10)postbit_legacy
  • (10)postbit_onlinestatus
  • (10)postbit_reputation
  • (10)postbit_wrapper
  • (4)showthread_bookmarksite
  • (5)showthread_similarthreadbit
  • (1)showthread_similarthreads
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_datastore.php
  • ./includes/datastore/datastore_cache.php
  • ./includes/class_hook.php
  • ./includes/functions_cat_cfgeoblock.php
  • ./includes/functions_cat_edittime.php
  • ./includes/adminfunctions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php 

Hooks Called:
  • init_startup
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • reputation_image
  • bbcode_parse_start
  • postbit_imicons
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • tag_fetchbit_complete
  • showthread_similarthread_query
  • showthread_similarthreadbit
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete