CS253

CS253: Software Development with C++                

Spring 2017                

HW 4                

CS253 HW4: Unicode!                

Description                

Write a C++ program called uni.cc that behaves as HW3, except that it processes UTF-8 characters, as described in lecture.                 

Properties file                

The properties file can now be enormous. Here is an example: ~cs253/pub/UnicodeData.txt. Note that the properties file now has a slightly different format than the previous, ASCII-only, file.

As before, the properties file need not be in any particular order, and “holes” may exist.                 

The -all option is still valid, and refers to all the properties found in the properties file.                 

Arguments                

Arguments are in this order:                 

How do you tell which arguments are options?                

They’re the leading arguments that start with a dash.                 

How do I know where the options end?                

When an argument is encountered without a dash, or you run out of arguments.                 

What if a later argument starts with a dash?                

What if it does? It’s not an option. All the options are together, at the beginning. Anything after that is not an option.                 

Sample Runs                

Here are several sample runs. “%” is my prompt:                 

    % echo -e 'a 5 \U3a9 \U4dca \U1f42e' >data
    % cat data
    a 5 Ω ䷊ 🐮
    % ./a.out ~cs253/pub/UnicodeData.txt data
    % ./a.out -Lu -Ll ~cs253/pub/UnicodeData.txt data
    Ll: 1
    Lu: 1
    % ./a.out -all ~cs253/pub/UnicodeData.txt data
    Cc: 1
    Cf: 0
    Co: 0
    Cs: 0
    Ll: 1
    Lm: 0
    Lo: 0
    Lt: 0
    Lu: 1
    Mc: 0
    Me: 0
    Mn: 0
    Nd: 1
    Nl: 0
    No: 0
    Pc: 0
    Pd: 0
    Pe: 0
    Pf: 0
    Pi: 0
    Po: 0
    Ps: 0
    Sc: 0
    Sk: 0
    Sm: 0
    So: 2
    Zl: 0
    Zp: 0
    Zs: 4
    % ./a.out -all ~cs253/pub/UnicodeData.txt ~cs253/pub/hamlet.txt
    Cc: 10412
    Cf: 0
    Co: 0
    Cs: 0
    Ll: 119683
    Lm: 0
    Lo: 0
    Lt: 0
    Lu: 16350
    Mc: 0
    Me: 0
    Mn: 0
    Nd: 0
    Nl: 0
    No: 0
    Pc: 0
    Pd: 422
    Pe: 261
    Pf: 0
    Pi: 0
    Po: 7418
    Ps: 261
    Sc: 0
    Sk: 0
    Sm: 48
    So: 0
    Zl: 0
    Zp: 0
    Zs: 27713

Requirements                

The requirements are the same as those for HW3, plus:                 

Ask                

If you have any questions about the requirements, ask. In the real world, your programming tasks will almost always be vague and incompletely specified. Same here.                 

How to submit your homework:                

Use web checkin, or Linux checkin:                 

    ~cs253/bin/checkin HW4 uni.cc

How to receive negative points:                

Turn in someone else’s work.                 

Modified: 2017-02-28T13:42                 

User: Guest                 

Check: HTML CSS
Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building