Test Chat in BETA (Not Built Yet)

Discussion in 'C++' started by michael j g, Aug 4, 2011.

  1. michael j g

    michael j g New Member

    Joined:
    Nov 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Canteen at a school
    Location:
    SOUTH AUSTRALIA
    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.

    Example:
    /*
    <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.

    Code:
    #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.

    Michael.

    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.
     
    Last edited by a moderator: Aug 4, 2011
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    After staring at your....I hesitate to use the word "code"...for a while I figured you probably meant to write something like this:
    Code:
    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;
    	}
    	else
    	{
    		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.
     
  5. michael j g

    michael j g New Member

    Joined:
    Nov 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Canteen at a school
    Location:
    SOUTH AUSTRALIA
    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:


    else
    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.

    chatuser


    }

    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.
     
  6. michael j g

    michael j g New Member

    Joined:
    Nov 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Canteen at a school
    Location:
    SOUTH AUSTRALIA
    Found out what i need to sorta do.
    One problem can not understand how to do it: Repeat Function

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

    EX:

    #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!
     
  7. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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:
    Code:
    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)
        break;
    }
    
     
    michael j g likes this.
  8. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    By the way this is a really bad idea:
    Code:
    #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.
     
  9. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  10. michael j g

    michael j g New Member

    Joined:
    Nov 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Canteen at a school
    Location:
    SOUTH AUSTRALIA
    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!
     
  11. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    There isn't a #define chatuser......
     
  12. michael j g

    michael j g New Member

    Joined:
    Nov 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Canteen at a school
    Location:
    SOUTH AUSTRALIA
    Starting: BETA 103

    Started at: BETA 101

    Getting close to Working!
    Will make work for Self Chat but no more than that until got the Higher Skill.

    Also This Progect was for School set by a Teacher.
    So please do not say my level is not good enoth since he set me th Task.

    Other wise He Wouldnt Have!
     
  13. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    > Beta 103

    Well, you can call it whatever you like. I could call you an idiot. But the point of language is communication of ideas, and if you use the wrong words then you will communicate the wrong ideas. By "idiot" I meant a very smart person. So you shouldn't be offended.

    Self chat is dead easy. Read a string and display it, in a loop until some exit condition (what?)
    Code:
    for (;;)
    {
    cout << "Enter a chat string : ";
    cin >> str;
    // you could display it but it will already be shown as you typed it.
    cout << str;
    }
    
    Just wrap that in a main function and determine some exit condition and that's the task completed.
     
    michael j g likes this.
  14. michael j g

    michael j g New Member

    Joined:
    Nov 3, 2010
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Canteen at a school
    Location:
    SOUTH AUSTRALIA
    Well i read before i will Feel offended.
    Also try year 9 and a after school task.

    and the code you have i have being useing but with a user name called user.
    It sorta works, but the loop is puting back to the begining so i have to write a user again.
    that was in BETA 102.
    right now i am doing BETA 103.
    I plan on haveing the single chat working in the aloted time of 3-5 weeks.
    Due within time to the Teacher.
    PS: External Subject, i have a seprate course and have a Teacher who wants to see me make this in the alocated time.
    Hard work, skilled proffesion.
    Also i have Maths Assinment which is Very hard and makes this easyer.

    Thanks again!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice