Linux下的C++开发定义一个String的字符串

2015年04月21日 其他资源 10条评论 阅读9389次

Linux下的C++开发

Linux下的C++开发想要定义一个String的字符串

直接写string str = "hello"; 会出现下面这样的编译报错

error: 'string' was not declared in this scope

看到网上的方法加入下面的include也是出现了另外一个错误

#include<string.h>

error: 'string' does not name a type

不知道是神马原因,后来想到了用标准C中定义字符串的方法。

// to define a string in C++

char str[] = "xxxx";

如果有强迫症一定想要写string。。。的可以自定义一个类型。

typedef  char STRING[100];

后续使用时可以直接用STRING str = "hello";的写法。

C++新手就只写这样菜鸟的文章,随时记录随时更新。

分享本文至:

WRITTEN BY

avatar
本文标签:C++
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

10 条评论

  1. avatar hzrdcraft

    <a href="http://www.swingergroup.com/adidas-damian-lillard-2-schwarz-wei%C3%9F-schuhel">adidas damian lillard 2 schwarz wei脽</a> <a href="http://www.bluelakebooks.com/asics-gel-noosa-tri-8-corriendo-zapatos-mujeres-top-skoe">asics gel noosa tri 8 corriendo zapatos mujeres top</a> <a href="http://www.lideresworld.com/femminile-nike-kobe-9-low-blu-grigio-footg">femminile nike kobe 9 low blu grigio</a> <a href="http://www.navixstream.com/femminile-air-jordan-retro-14-tutti-oro-sneakerd">femminile air jordan retro 14 tutti oro</a> <a href="http://www.clarinblogs.com/nike-hyperrev-2015-verde-bianca-schuhee">nike hyperrev 2015 verde bianca</a> <a href="http://www.telecomcierge.com/nike-air-max-1-ultra-moire-neutral-gr%C3%A5-footf">nike air max 1 ultra moire neutral gr氓</a>
    hzrdcraft http://www.hzrdcraft.com/

  2. avatar dmvantalya

    <a href="http://www.poppiesdelray.com/frau-nike-air-max-2016-schwarz-blau-wei%C3%9F-schuhei">frau nike air max 2016 schwarz blau wei脽</a> <a href="http://www.soundsofbuzz.com/nike-air-max-2016-svart-gr%C3%A5-obuvj">nike air max 2016 svart gr氓</a> <a href="http://www.hozloli.com/adidas-15.1-ic-arancia-scarpel">adidas 15.1 ic arancia</a> <a href="http://www.privetaustria.com/hommes-asics-gel-lyte-v-5-volcano-burgundy-rouge-rose-chaussuresh">hommes asics gel lyte v 5 volcano burgundy rouge rose</a> <a href="http://www.goodnnasty.com/nike-huarache-ultra-blu-grigio-scarpeh">nike huarache ultra blu grigio</a> <a href="http://www.ankarasanal.com/nike-odell-beckham-jersey-nfli">nike odell beckham jersey</a>
    dmvantalya http://www.dmvantalya.com/

  3. avatar zestchannel

    <a href="http://www.unefinemouche.com/mujeres-air-max-90-hyperfuse-oro-rojo-zapatosk">mujeres air max 90 hyperfuse oro rojo</a> <a href="http://www.ayuinc.com/nike-kyrie-3-grey-gold-shoesi">nike kyrie 3 grey gold</a> <a href="http://www.unirlisboa.com/air-jordan-retro-6-gr%C3%BCn-brot-schuhei">air jordan retro 6 gr眉n brot</a> <a href="http://www.escortfeeds.com/nike-air-max-95-mujeres-blanco-verde-zapatosp">nike air max 95 mujeres blanco verde</a> <a href="http://www.rdjanitorial.com/nike-lunar-force-1-high-r%C3%B8d-skoi">nike lunar force 1 high r酶d</a> <a href="http://www.bookoobeats.com/nike-air-max-tailwind-8-kvinners-oransje-gul-obuvq">nike air max tailwind 8 kvinners oransje gul</a>
    zestchannel http://www.zestchannel.com/

  4. avatar lovemescort

    <a href="http://www.hutchinsmedia.com/odell-beckham-jr-college-jersey-nfli">odell beckham jr college jersey</a> <a href="http://www.datesfordate.com/converse-all-star-r%C3%B8d-obuvk">converse all star r酶d</a> <a href="http://www.spchemtech.com/coach-leather-crossbody-bag-sale-coachh">coach leather crossbody bag sale</a> <a href="http://www.eadamattia.com/nike-stefan-janoski-nero-pelle-scarpej">nike stefan janoski nero pelle</a> <a href="http://www.citypixxel.com/nike-kobe-ad-nero-oro-scarpei">nike kobe ad nero oro</a> <a href="http://www.megasatinc.com/washington-capitals-reebok-nhl-2nd-season-flex-cap-hath">washington capitals reebok nhl 2nd season flex cap</a>
    lovemescort http://www.lovemescort.com/

  5. avatar dientedeperro

    <a href="http://www.danielbroman.com/nike-hyperdunk-2014-r%C3%B8d-lyser%C3%B8d-scarpea">nike hyperdunk 2014 r酶d lyser酶d</a> <a href="http://www.integrityphx.com/baltimore-orioles-new-era-mlb-leisure-39thirty-cap-hati">baltimore orioles new era mlb leisure 39thirty cap</a> <a href="http://www.onthecar.com/adidas-neo-skate-azul-blanco-trainersb">adidas neo skate azul blanco</a> <a href="http://www.sallysoldit.com/air-max-2014-herre-sort-kurpesd">air max 2014 herre sort</a> <a href="http://www.hairsalonlush.com/nike-dunk-high-sb-schwarz-gum-schuhel">nike dunk high sb schwarz gum</a> <a href="http://www.robverheulen.com/nike-kobe-10-flyknit-low-lows-for-vente-skof">nike kobe 10 flyknit low lows for vente</a>
    dientedeperro http://www.dientedeperro.com/

  6. avatar michiganev

    <a href="http://www.townyplay.com/dam%C3%A4nner-converse-schwarz-alle-star-oxford-mono-trainers-schuhek">dam盲nner converse schwarz alle star oxford mono trainers</a> <a href="http://www.djpunjabii.com/demarcus-cousins-throwback-jersey-nflh">demarcus cousins throwback jersey</a> <a href="http://www.avsomurie.com/adidas-tubular-triple-svart-doom-obuvi">adidas tubular triple svart doom</a> <a href="http://www.circusveil.com/nike-mercurial-superfly-v-fg-grey-green-black-shoesj">nike mercurial superfly v fg grey green black</a> <a href="http://www.laconiaoil.com/pink-ladies-converse-shoes-shoesl">pink ladies converse shoes</a> <a href="http://www.hurizmir.com/polo-ralph-lauren-blue-polo-shirt-poloh">polo ralph lauren blue polo shirt</a>
    michiganev http://www.michiganev.com/

  7. avatar pleinairjourney

    <a href="http://www.matkailuvarkaus.net/nike-air-force-1-duckboot-gr%C3%BCn-schuhed">nike air force 1 duckboot gr眉n</a> <a href="http://www.medmanage.net/air-jordan-retro-30-grigio-rosa-butye">air jordan retro 30 grigio rosa</a> <a href="http://www.medsample.net/jordan-3-hvid-gr%C3%A5-obuvd">jordan 3 hvid gr氓</a> <a href="http://www.metacommunities.net/nike-air-max-tailwind-6-vivid-bleu-color-obuvg">nike air max tailwind 6 vivid bleu color</a> <a href="http://www.metalinquisition.net/jordan-retro-3-sandals-sort-schuhef">jordan retro 3 sandals sort</a> <a href="http://www.michigangolfguide.net/free-flyknit-4.0-corriendo-zapatos-obuve">free flyknit 4.0 corriendo zapatos</a>
    pleinairjourney http://www.pleinairjourney.net/

  8. avatar keleric

    <a href="http://www.unefinemouche.com/nike-free-inneva-woven-sp-night-stadium-wolf-grigio-scarpeh">nike free inneva woven sp night stadium wolf grigio</a> <a href="http://www.ayuinc.com/nike-air-max-90-premium-gituttio-verde-scarpei">nike air max 90 premium gituttio verde</a> <a href="http://www.unirlisboa.com/air-jordan-retro-6-dam%C3%A4nner-blau-himmelblau-schuheh">air jordan retro 6 dam盲nner blau himmelblau</a> <a href="http://www.escortfeeds.com/womens-nike-dunk-orange-blue-shoesq">womens nike dunk orange blue</a> <a href="http://www.rdjanitorial.com/america-jersey-2015-third-green-o-peralta-sambueza-soccer-jersey-14-15-nfli">america jersey 2015 third green o peralta sambueza soccer jersey 14 15</a> <a href="http://www.bookoobeats.com/mennns-asics-asics-gel-kinsei-2-rosa-gul-obuvp">mennns asics asics gel kinsei 2 rosa gul</a>
    keleric http://www.keleric.com/

  9. avatar doctid

    <a href="http://www.facenextday.com/dam%C3%A4nner-nike-kyrie-1-rosa-orange-kurpesb">dam盲nner nike kyrie 1 rosa orange</a> <a href="http://www.mellowsblues.com/nike-free-flyknit-chukka-p%C3%BArpura-amarillo-schuhee">nike free flyknit chukka p煤rpura amarillo</a> <a href="http://www.stackdotnet.com/herre-nike-free-flyknit-5.0-sort-guld-butyd">herre nike free flyknit 5.0 sort guld</a> <a href="http://www.donatelia.com/nike-kaishi-lightweight-sneaker-kvinders-gul-obuvc">nike kaishi lightweight sneaker kvinders gul</a> <a href="http://www.jafcosupply.com/jordan-11-low-gray-armada-scarpee">jordan 11 low gray armada</a> <a href="http://www.kanaldtvizle.com/air-jordan-retro-8-blanco-p%C3%BArpura-obuvd">air jordan retro 8 blanco p煤rpura</a>
    [url=http://www.doctid.com/]doctid[/url]

  10. avatar meknesmorocco

    <a href="http://www.sidecisions.com/adidas-ultra-boost-st-herre-hvid-chaussuresd">adidas ultra boost st herre hvid</a> <a href="http://www.htmlpast.com/nike-sb-royal-blu-nero-obuve">nike sb royal blu nero</a> <a href="http://www.djdikkethomas.com/nike-air-max-zero-femminile-nero-arancia-kurpesd">nike air max zero femminile nero arancia</a> <a href="http://www.dumpthatdebt.com/new-blance-620-b%C3%B8rn-hvid-orange-schuhec">new blance 620 b酶rn hvid orange</a> <a href="http://www.syderagencys.com/nike-hyperdunk-violet-or-butyg">nike hyperdunk violet or</a> <a href="http://www.atvhdizle.com/roshe-run-flyknit-negro-midnight-scarped">roshe run flyknit negro midnight</a>
    meknesmorocco http://www.meknesmorocco.com/

欢迎留言




用户登录

sitemap