Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Test Chat in BETA (Not Built Yet) (http://www.go4expert.com/forums/test-chat-beta-built-t26440/)

michael j g 4Aug2011 18:03

Test Chat in BETA (Not Built Yet)
Hello as the Title Says i am Makeing Something like a Chat room.
I want to make a Place where you can Chose Friends to Talk with.
Not alike a Facebook.

<Name104>: Hey i think that is a good idea.
<Name101>: Well Thank you for your Concideration.
<Name110>: I Dont like it. But that is Just My opinion!
<Name101>: Well that is okay! :)

I have Started Basicly with Problems.
Told Sorta How to Do it but the Person who told me was Wrong.


#include <iostream>
#include <string> //The Chater Call and Name Asker.
using namespace std;
int main()

string name = ""; //Linking "name" to "name".
cout << "Enter your User Name and Press enter: ";
cin << name;
cout << "Invite Friends (Y = Yes /N = No)" << string friendsyes = "";
cin << friends;
if Y = friendsyes; //To show From Here to:
if y = friendsyes;
if yes = friendsyes;
if Yes = friendsyes;
if YES = friendsyes; //Here that you Might do it these Ways? linking Wrong.
string friendsyes = ""
cout << "You said yes Please enter their User name: ";
cin << friendsyes; //Linking All "friendsyes" To add a User Name in!
cout << "You said No Precide to Chat";//Chat room that you are in or were in you can go back to! Still codeing/?
cout << endl;
cout << "The Chat Beta Test 0.1 has Worked. Please make more Work Codeing" << endl << endl; //This Is for Beta Only as this Line Says. Not Started Not Finnished!

This is the Start of Beta.

10 mins to Write code.

Help Will Deaply Be Appreciated.


PS: A Great way to help a Rookiy is to Help Them understand code that you Put down.

Also to try helping Chose Codes to Fit!

Will Need Help with a Lot:
Linking Chat
Repeating Talk //You can write a Spesific code and will say Good Bye and Close Program.

system ("Pause") //Never has worked for me.

More Problems will be listed later.

xpi0t0s 5Aug2011 12:31

Re: Test Chat in BETA (Not Built Yet)
If you're still at the level of thinking that "if Y = friendsyes;" is valid code then a chat room is a project you should shelve for now and concentrate on working through the exercises in your book. Get the language sorted first, then you can work on more complex projects. A chatroom is NOT a simple task suitable for a beginner who doesn't yet know the syntax of if statements.

xpi0t0s 5Aug2011 12:32

Re: Test Chat in BETA (Not Built Yet)
And by the way another great way of helping a Rooky is to focus them on what will help them. This chatroom project is WAAAAAAAAAAAY beyond your abilities at the moment: think of a four-year-old child who's just spent 5 minutes playing with a screwdriver and announces he now wants to build a car.

xpi0t0s 5Aug2011 13:11

Re: Test Chat in BETA (Not Built Yet)
After staring at your....I hesitate to use the word "code"...for a while I figured you probably meant to write something like this:

int main()
        string name, yesno;
        cout << "Enter your username : ";
        cin >> name;
        cout << "Invite a friend? (Y/N) : ";
        cin >> yesno;
        while (yesno != "Y" && yesno != "N")
                cout << "Invalid entry; please type Y for Yes or N for No : ";
                cin >> yesno;
        if (yesno == "Y")
                string fname;
                cout << "Enter friend's name : ";
                cin >> fname;
                cout << "You entered '" << fname << "'. More code needed." << endl;
                cout << "What, you want to chat with yourself?  Just run Notepad then." << endl;
        return 0;

You are nowhere near Beta by the way. This is not even Alpha. Alpha testing is internal testing of the COMPLETE program that the developers feel is ready to hit the streets but the sensible business types want to test it inhouse away from the developers for a bit. Once they're satisfied (and bugs have been found and fixed, testing repeated and no further bugs found) it's time to try it out in a limited number of real-world scenarios. *This* is Beta testing, where the customers get their hands on a new product and can play with its features but have to be aware that there may still be bugs in.

So assuming the four-year-old is now all "wanna build a car wanna build a car wanna build a car wanna build a car wanna build a car wanna build a car"...

Did you mean this should be LIKE Facebook or UNLIKE Facebook? If unlike, I have no idea what you want it to be like so I'll assume you mean LIKE. Facebook uses a central server to store messages and the users connect through their browsers. What technology are you going to use on the server? Are you going to use a database to store messages or store them in a program's memory? What happens when (not if) the program crashes - all messages will be lost if they're not stored somewhere?

What protocol are you going to use between the clients and the server? Are you going to roll your own or use an existing one? The program above - is this the start of the client application or the server application? Or are you going to use distributed technology to store messages and this will be both? If distributed, this will be UNLIKE Facebook because they do NOT use distributed tech; all your messages are stored on their servers.

I'll stop there because your brain will now have melted. Maybe back to those exercises in Chapter 3? <grin> But your enthusiasm is great; keep thinking of projects, but be aware that any real-world projects are going to be beyond you right now, although there's nothing wrong with playing around with various ideas. I have a number of projects on the go - chess solvers and the like, even an ambitious compiler suite comprising a C compiler, Z80 emulator, assembler, disassembler, linker etc - that'll probably never get finished; I just get them out every so often when I have that itch to scratch.

michael j g 5Aug2011 16:35

Re: Test Chat in BETA (Not Built Yet)
Okay i get it.
I had only called it BETA since it is Still getting Developed.
Also I found a Lotta things i needed just need to do more to Talk with Yourself.

So Far i now need to Figer out how to Repet the Same String and write something Different.

I still have a long Way to go i know.

I also know that i need to put in some counter parts for stoping it killing Your PC.

Why: Memory.
It will store all that Data and may slow your computer if you do not Reboot.

I am not even half way to makeing it Work VIA Lan/Internet.

I am up to Looping one Is compleat just need to do the other:

cout << "Trying to Starting Chat Please Wait a Few Moments..." << endl;//Saying It will Run Link "Yes".
string user = ""; //Users name for Chating!
cout << "enter Username and Press enter: ";
cin >> user;//Telling PC to Hold Username.

string chat = ""; //What you Write will be used in Chat!
cout << "Now you can Write a Message: " << endl;
cin >> chat; //Your Chat Message
getline(cin, chat); //The whole Chat message.



I am still workin on Some misstacks but they will be fixed at the Next Bug Fix Slot Time!

Do not run the Above as dose not work = Errors.

michael j g 5Aug2011 16:56

Re: Test Chat in BETA (Not Built Yet)
Found out what i need to sorta do.
One problem can not understand how to do it: Repeat Function

Loop may not do it as it loops what i don want to loop!


#include <iostream>
#include <string>
#define sentence cout << sentence << endl;
using namespace std;
int main()
string sentence = ""; // Want to Repeat this base Function.
cout << "Write Something: ";
cin sentence;

? Have lost myself!

xpi0t0s 5Aug2011 19:39

Re: Test Chat in BETA (Not Built Yet)
Well there are several ways of looping. My code shows you one way. I suggest you experiment with the examples in whatever book/course you are following until you get the hang of them.

The simplest loop - an infinite loop - can be done as follows:

for (;;)
  // put here the statements you want to repeat
  // if you know that when the variable V becomes TRUE you want the loop to end, you
  // can do something like this:
  if (V)

xpi0t0s 5Aug2011 19:40

Re: Test Chat in BETA (Not Built Yet)
By the way this is a really bad idea:

#define sentence cout << sentence << endl;
Don't use #defines until you really understand all their implications, and given that you think this is valid, I would suggest you do not use them AT ALL for any reason.

xpi0t0s 5Aug2011 19:41

Re: Test Chat in BETA (Not Built Yet)
Oh and a repeat IS a loop. You cannot repeat without a loop, except by unrolling the loop, but that only works if you know at compile time how many times you want to repeat.

michael j g 5Aug2011 19:57

Re: Test Chat in BETA (Not Built Yet)
Thankyou for your Help.
I have Noticed that It dose not Like the #define chatuser ?
And also i was doing well till i hit a wall.
All programers hit walls at times!

All times are GMT +5.5. The time now is 03:37.