gerard4143 371 Nearly a Posting Maven

@deceptikon

That's the point. How does an uppercase function work when its used with utf8? A uppercase function would be pretty simple arithmetic with ASCII values but I fail to see how that function would work with utf8.

gerard4143 371 Nearly a Posting Maven

I have a simple question about unicode and utf8.

How does a utf8 encoding know what its uppercase encoding is? I understand how utf8 encoding carries its unicode value embedded in itself but I fail to see how it maps a utf8 encoding to an uppercase unicode value. What is the mechanism which maps utf8 encodings to uppercase encodings or the other features available in the unicode universe?

gerard4143 371 Nearly a Posting Maven

Or posting in the wrong section?

fahadmunir32 commented: Can u tell where to post this kind of discussion +0
gerard4143 371 Nearly a Posting Maven

I think you are confused. First you write the program and then you post it with any problems you are having.

gerard4143 371 Nearly a Posting Maven

Ok, which functions and line numbers are you talking about?

gerard4143 371 Nearly a Posting Maven

The solution or hints of a solution depend on which data structures you plan to use. Could you post what you have so far?

gerard4143 371 Nearly a Posting Maven

Shouldn't this

scanf("%s", &employeeIDNew);

be

scanf("%s", employeeIDNew);
gerard4143 371 Nearly a Posting Maven

Well 3 divided by 5 has 3 left over. The modulus operator computes the remainder of integer division.

gerard4143 371 Nearly a Posting Maven

I guess you are not aware of our homework policy.

We don't do homework problems.

If you want help with a specific problem then you'll have to post the code and indicate exactly where and what the problem is.

gerard4143 371 Nearly a Posting Maven

The difference between a democracy and a dictatorship is that in a democracy you vote first and take orders later; in a dictatorship you don't have to waste your time voting.

Charles Bukowski

gerard4143 371 Nearly a Posting Maven

You can set the delimiter for getline().

istream& getline (istream& is, string& str, char delim);

Please check out this link
http://www.cplusplus.com/reference/string/string/getline/

gerard4143 371 Nearly a Posting Maven

Can you post your code?

gerard4143 371 Nearly a Posting Maven

Do you mean something like this?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char**argv)
{
    /*make sure str1 is padded with enough room*/
    char str1[] = {'H','e','l','l','o',',',' ','W','o','r','l','d','\0',' ',' ', ' ', ' ', ' ', ' '};
    char str2[] = "this is more text";

    fprintf(stdout, "str1->%s\n", str1);
    fprintf(stdout, "str2->%s\n", str2);

    /*append text*/

    strcat(str1, &str2[12]);

    fprintf(stdout, "str1->%s\n", str1);

    exit(EXIT_SUCCESS);
}
gerard4143 371 Nearly a Posting Maven

How can i do it?

Depends. Do you want to overwrite the characters or do you want to insert the characters and shift everything down..

gerard4143 371 Nearly a Posting Maven

Actually, what is going on here?

void toss(int & x)
//0=heads 1=tails
x=rand()%2;
int result(int a, int b, int c)
{
...
}
gerard4143 371 Nearly a Posting Maven

You seem to be missing the opening brace here

void toss(int & x)//missing brace here
//0=heads 1=tails
x=rand()%2;
gerard4143 371 Nearly a Posting Maven

Are you sure the datafile is in the same folder as the executable.

gerard4143 371 Nearly a Posting Maven

Did you pass std::endl or "\n" to std::cout?

gerard4143 371 Nearly a Posting Maven

Try running this program with your data.

#include <iostream>
#include <fstream>

using namespace std;

int main(int argc, char** argv) 
{
    ifstream names;

    names.open("P25.txt");

    string data;

    while(names >> data)
    {
        cout << "You read->" << data << "<-into data!" << std::endl;
    }

    names.close();

    return 0;
}
gerard4143 371 Nearly a Posting Maven

Here you go....

#include <stdio.h>

#define ARR_SIZE 10

int main()
{
    size_t i = 0;
    char chr_arr[ARR_SIZE];

    /*populate int_arr*/

    for (; i < ARR_SIZE; ++i)
    {
        if (chr_arr[i] /*meets some condition*/)
        {

        }
    }
    return 0;
}

Now lets see you write the condition part and populate the array.

gerard4143 371 Nearly a Posting Maven

C++ is a play on the C programming language increment operator. C++ literally means C language incremented.

What's the purpose of it? Here check the wiki

http://en.wikipedia.org/?title=C%2B%2B

gerard4143 371 Nearly a Posting Maven
gerard4143 371 Nearly a Posting Maven

OK. What have you tried so far?

gerard4143 371 Nearly a Posting Maven

Yes, you will searching for the element contained in the array std. If you need to search id in the array std then you could loop through std and check each id.

size_t i = 0;

for (; i < 100; ++i)
{
    if (std[i].id == some_int)
    {
        //do something here
    }
}
gerard4143 371 Nearly a Posting Maven

Well first you have to identify which platform this OS will run on and then you have to brush up on that platform's assembler code.

gerard4143 371 Nearly a Posting Maven

Could you please give more details?

gerard4143 371 Nearly a Posting Maven

I think you can use any compiler which has the ability modify the linker, GNU's compiler has linker scripts which controls this important aspect.

gerard4143 371 Nearly a Posting Maven

Well this is how you access an element of std[100] and get its elements.

std[searchid].id
std[searchid].name
std[searchid].fatherName
std[searchid].motherName
centenond commented: (y) +0
gerard4143 371 Nearly a Posting Maven

Try reopening the input file or setting the file position back to the beginning with fseek() on line 22.

gerard4143 371 Nearly a Posting Maven

Thanks. I didn't realize the software section had a generic top-level which caught everything in the software section.

gerard4143 371 Nearly a Posting Maven

I'm curious as to where a member would post a question on ML(Ocaml) type language?

gerard4143 371 Nearly a Posting Maven

If you insists on breaking out of the loop immediately then you should use break.

Something like this...

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
    int employeeNumber = 0;

    while( true )
    {
        cout << "\nEmplyee Number: ";
        cin >> employeeNumber;
        cout << endl;

        if ( employeeNumber == 0 ) break;

        while( true )
        {
            cout << "Inner loop\n";
            //do something here
        }
    }
    cout << "Done" << endl;
    return 0;
}
gerard4143 371 Nearly a Posting Maven

Shouldn't this have a semi-colon after it?

struct item { int* num ; int* q; };//semi-colon

Why are the structure elements pointers? If you insist on pointers then you'll have to allocate memory for them or point them to valid memory before you use them.

gerard4143 371 Nearly a Posting Maven

If you want to save yourself some frustration then don't include this in your header file

using namespace std;

Header files shouldn't expose anything in a namespace.

gerard4143 371 Nearly a Posting Maven

I'm pretty sure the standard says something about modifying the value past to the function in for_each(). If you want to change a value past to a function then I would investigate the transform() function.

Oops. My bad, I was thinking about something else. Please ignore.

gerard4143 371 Nearly a Posting Maven

This forums provides help to users who have specific questions. It isn't a free programming advice column.

gerard4143 371 Nearly a Posting Maven

Could you elaborate on your question?

gerard4143 371 Nearly a Posting Maven

I have a question about this line

scanf("%d", &val);

Why are you reading a integer into a character? Won't it make more sense to read the characters directly into the character array?

scanf("%20s", a); 
gerard4143 371 Nearly a Posting Maven

Did you try the function tolower()? You could apply this to each character and perform any calculations to the result.

gerard4143 371 Nearly a Posting Maven

Well what do you need help with? Please post the code you attempted and highlight any sections and explain the problems.

gerard4143 371 Nearly a Posting Maven

I'm at a complete lose as to what you are trying to accomplish here...

gerard4143 371 Nearly a Posting Maven

Try looking at the function here:

#include <iostream>

using namespace std;
int ture ( int a[], int b[], int d);

int main ()
{
    int b [5]={1,2,3,4,5};
    int a [5] ={1,2,3,4,5};

    cout << ture(b, a, 5) << endl;
}

int ture ( int a[], int b[], int d)
{
    for (int i = 0; i < d; i++)
    {
        if (a[i] != b[i])
        {
            return false;
        }
    }
    return true;
}
gerard4143 371 Nearly a Posting Maven

The arrays are fine! Do you have another problem with the code?

Doesn't this for loop run past your arrays?

for (int d = 0; d < 10; d++)//arrays have five elements
{
...
}

This function returns int but you return boolean inside the function. What does this function accomplish?

int ture ( int a[], int b[], int d)
{
    const double NUM = 10;
    for (int d = 0; d < 10; d++)
    {
        if (a[d] != b[d])
        {
            return false;
        }
    }
    return true;
}
gerard4143 371 Nearly a Posting Maven

I would have to say that you need a flagging system which marks a integer element when its been counted.

Are you sure this is C?

for(int i = 0; i < 10; i++)
{
...
}
gerard4143 371 Nearly a Posting Maven

Number one. Why all the semi-colons?

Here. Can you spot the error now?

class Timerange
{
public:

    Timerange(string initstring)
    {
        string current = "";
        unsigned short mode = 0;
        string timeA;
        string weekday;
        string timeB;
        for(unsigned short i = 0; i<initstring.length(); i++)
        {
            char c = initstring[i];
            if (c == ' ')
            {

            };//hint its here
            else
            { 

            }
        }
    }
};
gerard4143 371 Nearly a Posting Maven

Looking at your code I find that you have to make a decision. Do you want to calculate the average once and store the value in the structure Student or do you want to calculate the student average each time you need it.

void Print_List(Student List[], int Size)
{
    cout <<left << fixed << setprecision(2) <<showpoint <<endl ;
    cout << setw(19) << "Name" 
    << setw(18) << "ID" 
    << setw(18) << "Average" 
    << setw(16) << "Grade" << endl;

    cout << "=============================================================" << endl;

    for(int i = 0; i < Size;i++)
        cout << setw(19) << List[i].LastName +", "+ List[i].FirstName
        << setw(18) << List[i].Id 
        << setw(20) << calcAverage(List[i])//I use the return value here but it also stores the result in student
        << List[i].Grade << endl;
}
gerard4143 371 Nearly a Posting Maven

OK. What compiler and IDE are you using?

gerard4143 371 Nearly a Posting Maven

Did you check that the compiler was C++? It may be defaulting to C. I know NetBeans - C\C++ plugin will do this sometines.

gerard4143 371 Nearly a Posting Maven

Are you sure your compiling this with a C++ compiler? Could you be using a C compiler?

gerard4143 371 Nearly a Posting Maven

Try something like this.

void displayTruck()
{
    for (size_t i = 0; i < counter; ++i)
        std::cout << itemPtr[i]->getMaker() << itemPtr[i]->getCost() << std::endl;
}