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

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

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++
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

12 条评论

  1. <a href="http://www.momoange.com/nike-cortez-silber-grau-schuheh">nike cortez silber grau</a> <a href="http://www.buscomimotor.com/nike-air-max-2017-black-and-blue-shoesk">nike air max 2017 black and blue</a> <a href="http://www.bestzixiutang.com/nike-roshe-two-flyknit-gul-mintgr%C3%B8n-skoj">nike roshe two flyknit gul mintgr酶n</a> <a href="http://www.pmatrading.com/air-jordan-12-rot-suede-concept-schuheh">air jordan 12 rot suede concept</a> <a href="http://www.beckyhasaplan.com/air-jordan-retro-1-red-and-black-shoesk">air jordan retro 1 red and black</a> <a href="http://www.meetspotme.com/michael-kors-jet-set-travel-smartphone-crossbody-mkh">michael kors jet set travel smartphone crossbody</a>
    sophiarugby http://www.sophiarugby.com/

  2. avatar tunnelcity

    <a href="http://www.michalowsky.net/jordan-1-schwarz-schwarz-gum-kurpesc">jordan 1 schwarz schwarz gum</a> <a href="http://www.michellany.net/kd-7-orange-and-bl%C3%A5-october-scarpec">kd 7 orange and bl氓 october</a> <a href="http://www.midwestbiblechurch.net/aidas-boost-clima-chill-schwarz-grau-schuhed">aidas boost clima chill schwarz grau</a> <a href="http://www.minevival.net/adidas-john-wtodas-2-azul-negro-obuvf">adidas john wtodas 2 azul negro</a> <a href="http://www.miotesoro.net/nike-flyknit-lunar-1-lyser%C3%B8d-flash-flyknit-butya">nike flyknit lunar 1 lyser酶d flash flyknit</a> <a href="http://www.mjdna.net/nike-kobe-11-flyknit-alle-lilla-butya">nike kobe 11 flyknit alle lilla</a>
    tunnelcity http://www.tunnelcity.net/

  3. avatar tobepartridge

    <a href="http://www.lagunawoodsre.com/herre-asics-gel-kayano-21-s%C3%B8lv-r%C3%B8d-skol">herre asics gel kayano 21 s酶lv r酶d</a> <a href="http://www.highbacklink.com/nike-zoom-pegasus-34-viola-verde-scarpeh">nike zoom pegasus 34 viola verde</a> <a href="http://www.vuurogen.com/nike-air-max-1-verde-gituttio-scarpei">nike air max 1 verde gituttio</a> <a href="http://www.rsvppersonnel.com/herren-air-max-lunar-90-wei%C3%9F-gelb-schuheh">herren air max lunar 90 wei脽 gelb</a> <a href="http://www.shonema.com/womens-nike-air-max-95-pink-gold-shoesl">womens nike air max 95 pink gold</a> <a href="http://www.enventsurvey.com/dez-bryant-white-jersey-nfli">dez bryant white jersey</a>
    tobepartridge http://www.tobepartridge.com/

  4. avatar javajoeshhi

    <a href="http://www.starizle.com/nike-free-5.0-hommes-cuir-butyd">nike free 5.0 hommes cuir</a> <a href="http://www.notpotatoes.com/femmes-nike-roshe-run-casual-chaussures-noir-blanc-volt-obuvc">femmes nike roshe run casual chaussures noir blanc volt</a> <a href="http://www.tedxuon.com/nike-lunarglide-8-le-nero-and-oro-femminile-oxfords-scarped">nike lunarglide 8 le nero and oro femminile oxfords</a> <a href="http://www.thejuicylucy.com/kvinners-nike-air-max-tailwind-5-bl%C3%A5-rosa-obuvc">kvinners nike air max tailwind 5 bl氓 rosa</a> <a href="http://www.almanyaonline.com/yeezy-boost-350-amarillo-light-chaussuresg">yeezy boost 350 amarillo light</a> <a href="http://www.trademelikes.com/nike-zoom-ascention-r%C3%B8d-orange-chaussuresa">nike zoom ascention r酶d orange</a>
    javajoeshhi http://www.javajoeshhi.com/

  5. avatar houshyaree

    <a href="http://www.priakurus.com/nike-air-max-1-essential-gr%C3%B8nn-obuvk">nike air max 1 essential gr酶nn</a> <a href="http://www.batatastudio.com/nike-free-tr-fit-5.0-maschio-verde-gituttio-grigio-scarpei">nike free tr fit 5.0 maschio verde gituttio grigio</a> <a href="http://www.kahawellness.com/nike-air-force-1-low-amarillo-zapatosh">nike air force 1 low amarillo</a> <a href="http://www.metabolifes.com/nike-lebron-soldier-10-alle-bl%C3%A5-skok">nike lebron soldier 10 alle bl氓</a> <a href="http://www.breconpharm.com/nike-lebron-xiii-menn-university-r%C3%B8d-hvit-svart-laser-oransje-obuvi">nike lebron xiii menn university r酶d hvit svart laser oransje</a> <a href="http://www.bagintaiwan.com/nike-air-max-tavas-blanco-and-gris-zapatosl">nike air max tavas blanco and gris</a>
    houshyaree http://www.houshyaree.com/

  6. avatar smartiesland

    <a href="http://www.sugarforspice.com/prada-luggage-bag-pradah">prada luggage bag</a> <a href="http://www.mybancorphsa.com/minnesota-wild-home-jersey-nfli">minnesota wild home jersey</a> <a href="http://www.scopatore.com/kd-trey-5-iii-gr%C3%B8n-skol">kd trey 5 iii gr酶n</a> <a href="http://www.galacticlogos.com/ralph-lauren-tate-handbag-poloh">ralph lauren tate handbag</a> <a href="http://www.ispardmore.com/nike-flyknit-lunar-2-yellow-shoesi">nike flyknit lunar 2 yellow</a> <a href="http://www.radioramabc.com/womens-nike-roshe-run-floral-yellow-orange-shoesp">womens nike roshe run floral yellow orange</a>
    smartiesland http://www.smartiesland.com/

  7. avatar jlchatlaw

    <a href="http://www.lauraundleon.com/nike-air-force-one-mid-07-black-white-runningf">nike air force one mid 07 black white</a> <a href="http://www.michaelphenow.com/zdeno-chara-33-boston-bruins-reebok-premier-alternate-jersey-small-nflv">zdeno chara 33 boston bruins reebok premier alternate jersey small</a> <a href="http://www.kguides.com/nike-hyperdunk-pink-shoes-trainersa">nike hyperdunk pink shoes</a> <a href="http://www.nvusforex.com/huarache-ultra-fl%C3%A5den-bl%C3%A5-paint-scarpec">huarache ultra fl氓den bl氓 paint</a> <a href="http://www.dinerwaresb.com/nike-roshe-run-sko-pattern-peach-hvit-kurpesc">nike roshe run sko pattern peach hvit</a> <a href="http://www.slipoverfx.com/ray-ban-rb2132-brown-gradient-on-antique-polarized-lens-sunglassesg">ray ban rb2132 brown gradient on antique polarized lens</a>
    jlchatlaw http://www.jlchatlaw.com/

  8. avatar newscenefiles

    <a href="http://www.softballinsider.net/air-jordan-30.5-noir-jaune-obuvf">air jordan 30.5 noir jaune</a> <a href="http://www.sohoartusa.net/adidas-prossoator-instinct-original-kurpese">adidas prossoator instinct original</a> <a href="http://www.sonegboom.net/kvinders-nike-air-max-87-sb-orange-gr%C3%A5-kurpesf">kvinders nike air max 87 sb orange gr氓</a> <a href="http://www.soulcircuit.net/adidas-projoator-instinct-eyes-and-tongue-schuheg">adidas projoator instinct eyes and tongue</a> <a href="http://www.soulmateunlimited.net/nike-air-max-90-noir-cuir-hommes-trainers-scarpef">nike air max 90 noir cuir hommes trainers</a> <a href="http://www.spideradio.net/air-max-90-blomsts-orange-lyser%C3%B8d-kurpesa">air max 90 blomsts orange lyser酶d</a>
    newscenefiles http://www.newscenefiles.net/

  9. avatar vendsweeps

    <a href="http://www.pepinmystep.com/billig-nike-tanjun-dam%C3%A4nner-wei%C3%9F-skod">billig nike tanjun dam盲nner wei脽</a> <a href="http://www.burayagidin.com/hermes-scarf-price-scarfr">hermes scarf price</a> <a href="http://www.wearechicanos.com/miami-dolphins-dolphin-hat-300-hatg">miami dolphins dolphin hat 300</a> <a href="http://www.oceantent.com/nike-flyknit-racer-m-skox">nike flyknit racer m</a> <a href="http://www.mymascensores.com/air-jordan-b-mo-white-orange-shoesb">air jordan b mo white orange</a> <a href="http://www.mbejobs.com/purple-silver-mens-new-balance-360-shoes-runningb">purple silver mens new balance 360 shoes</a>
    vendsweeps http://www.vendsweeps.com/

  10. avatar chinchout

    <a href="http://www.larrystoverjr.com/nike-air-max-2015-femmes-noir-or-obuvd">nike air max 2015 femmes noir or</a> <a href="http://www.gokartinfo.com/soccers-chaussures-gris-or-obuvg">soccers chaussures gris or</a> <a href="http://www.enemythunder.com/k%C3%B8be-nike-air-jordan-6-retro-sort-infrar%C3%B8d-schuhef">k酶be nike air jordan 6 retro sort infrar酶d</a> <a href="http://www.lahtacentr.com/vibram-fivefingers-sprint-bleu-ciel-jaune-obuve">vibram fivefingers sprint bleu ciel jaune</a> <a href="http://www.intspv.com/nike-roshe-run-oransje-and-bl%C3%A5-butye">nike roshe run oransje and bl氓</a> <a href="http://www.itsmylogo.com/nike-free-3.0-flyknit-mennns-obuvd">nike free 3.0 flyknit mennns</a>
    chinchout http://www.chinchout.com/

  11. avatar hunnyblu

    <a href="http://www.emmamoney.com/adidas-ultra-boost-sports-sko-butya">adidas ultra boost sports sko</a> <a href="http://www.guntruthers.com/lebron-12-low-blau-gelb-ribbon-obuvd">lebron 12 low blau gelb ribbon</a> <a href="http://www.jayandarmando.com/nike-air-presto-skull-marrone-scarpea">nike air presto skull marrone</a> <a href="http://www.mikevi.com/zx-flux-negro-mujeres-scarpef">zx flux negro mujeres</a> <a href="http://www.mynaturalogy.com/air-jordan-3-retro-gs-violet-volt-rose-glitter-obuvd">air jordan 3 retro gs violet volt rose glitter</a> <a href="http://www.wvusigmakappa.com/nike-zoom-pegasus-33-hvid-s%C3%B8lv-scarpea">nike zoom pegasus 33 hvid s酶lv</a>
    [url=http://www.hunnyblu.com/]hunnyblu[/url]

  12. avatar chateaudefous

    <a href="http://www.inckua.com/jordan-future-lime-green-black-and-gold-shoesc">jordan future lime green black and gold</a> <a href="http://www.essodustade.com/nike-air-max-1-hyperfuse-paris-home-turf-trainersb">nike air max 1 hyperfuse paris home turf</a> <a href="http://www.olgroupusainc.com/adidas-zx-750-dam%C3%A4nner-skob">adidas zx 750 dam盲nner</a> <a href="http://www.caryongpum.com/zx-750-light-onix-white-ball-sneakerb">zx 750 light onix white ball</a> <a href="http://www.postanje.com/mackage-cathryn-tote-mackager">mackage cathryn tote</a> <a href="http://www.synergysimple.com/mennns-nike-air-max-90-hvit-shoesn">mennns nike air max 90 hvit</a>
    chateaudefous http://www.chateaudefous.com/

欢迎留言




用户登录

sitemap