Thread: Need help with my school project!!!

  1. #1
    Registered User
    Join Date
    Jan 2014
    Posts
    2

    Need help with my school project!!!

    Hello !!!
    i am the begginer so please dont blame me but i have wird problem with my project. I am building a program witch is a base of selphones. im using a dynamic structures and everything was good with adding new element loading from disc and saving but i have a problem when i want compare somethin for example the names of 2 selphones. projekt_final_version.c ksw.txt
    Last edited by Maciek Grodzki; 01-06-2014 at 06:55 AM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you have written something, then what is your current code and how does it not work?

    If you have not yet written anything, then what is your plan to proceed, and what problems are you having with it?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Jan 2014
    Posts
    2
    i added txt file to load. i want fo example add function to remove element when they satisfy the condition for exaple they cost 1200 or name is Nokia or somethin like that but it doesnt work.

  4. #4
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Quote Originally Posted by Maciek Grodzki View Post
    i added txt file to load. i want fo example add function to remove element when they satisfy the condition for exaple they cost 1200 or name is Nokia or somethin like that but it doesnt work.
    The general idea of forums like this one is that help is provided for specific questions or problems. Your statement isn't a question, and if it was a question it still wouldn't be specific. So, the idea is that you present somecode that you've written that's giving you problems or not behaving as you'd expect and ask a specific question about it.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Comparing strings is usually done by including string.h and using the strcmp() function.

    Code:
    int i;
    char string1={"Bob"}, string2={"Chris"};
    
    i=strcmp(string1, string2);
    
    if(i<0)
        printf("string1 is less than string2\n");
    else if(i==0)
       printf("strings are the same\n");
    else //i>0
       printf("string1 is greater than string2\n");
    The return is always relative to string1. Low return (<0), string1 is lower than string2. High return (>0), string1 is higher, etc.

  6. #6
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Does C or C++ know to make them arrays?

    Code:
    char string1={"Bob"}, string2={"Chris"};
    Instead of the normal
    Code:
    char string1[]={"Bob"};
    char string2[]={"Chris"};
    Tim S.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. School Project Help
    By Joshua Hess in forum C++ Programming
    Replies: 9
    Last Post: 02-19-2013, 07:27 PM
  2. School project help
    By blckgoat in forum C Programming
    Replies: 8
    Last Post: 11-14-2011, 06:03 PM
  3. School Mini-Project on C/C++ (Need Your Help)..
    By EazTerence in forum C++ Programming
    Replies: 4
    Last Post: 09-08-2005, 01:08 AM
  4. school project help
    By yogai in forum C Programming
    Replies: 8
    Last Post: 09-09-2004, 06:03 PM
  5. Help with School Project
    By jtouron in forum C++ Programming
    Replies: 2
    Last Post: 10-10-2003, 12:27 AM