日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

c ++查找字符串_C ++数组| 查找输出程序| 套装5

發(fā)布時間:2023/12/1 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 c ++查找字符串_C ++数组| 查找输出程序| 套装5 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

c ++查找字符串

Program 1:

程序1:

#include <iostream> using namespace std;int main() {char* STR[] = { "HELLO", "HIII", "RAM", "SHYAM", "MOHAN" };cout << (*STR + 2)[2];return 0; }

Output:

輸出:

O

Explanation:

說明:

Here we create an array of pointers to store strings. Now, look at the cout statement,

在這里,我們創(chuàng)建一個指針數(shù)組來存儲字符串。 現(xiàn)在,看看cout語句,

cout<<(*STR+2)[2];

The above statement will print the element of the 4th index of 1st string because pointer STR pointing the 1st string that is "HELLO" so the above statement will print 'O'.

上面的語句將打印第一個字符串的第4 索引的元素,因為指針STR指向“ HELLO”的 第一個字符串,因此,上面的語句將打印“ O”

Program 2:

程式2:

#include <iostream> using namespace std;int main() {char STR[5][8] = { "HELLO", "HIII", "RAM", "SHYAM", "MOHAN" };cout << STR[2] + 1;return 0; }

Output:

輸出:

AM

Explanation:

說明:

Here, we created a program two-dimensional array for strings. Now look the cout statement,

在這里,我們?yōu)樽址畡?chuàng)建了一個程序二維數(shù)組。 現(xiàn)在看一下cout語句,

cout<<STR[2]+1;

In the above statement, STR[2] is pointing to the 'R' in the string? "RAM" and we move pointer one position ahead then it will print "AM" on the console screen.

在上面的語句中, STR [2]指向字符串“ RAM”中“ R ,我們將指針向前移動一個位置,然后它將在控制臺屏幕上打印“ AM”

Recommended posts

推薦的帖子

  • C++ Arrays | Find output programs | Set 1

    C ++數(shù)組| 查找輸出程序| 套裝1

  • C++ Arrays | Find output programs | Set 2

    C ++數(shù)組| 查找輸出程序| 套裝2

  • C++ Arrays | Find output programs | Set 3

    C ++數(shù)組| 查找輸出程序| 套裝3

  • C++ Arrays | Find output programs | Set 4

    C ++數(shù)組| 查找輸出程序| 套裝4

  • C++ Looping | Find output programs | Set 1

    C ++循環(huán)| 查找輸出程序| 套裝1

  • C++ Looping | Find output programs | Set 2

    C ++循環(huán)| 查找輸出程序| 套裝2

  • C++ Looping | Find output programs | Set 3

    C ++循環(huán)| 查找輸出程序| 套裝3

  • C++ Looping | Find output programs | Set 4

    C ++循環(huán)| 查找輸出程序| 套裝4

  • C++ Looping | Find output programs | Set 5

    C ++循環(huán)| 查找輸出程序| 套裝5

  • C++ Default Argument | Find output programs | Set 1

    C ++默認參數(shù)| 查找輸出程序| 套裝1

  • C++ Default Argument | Find output programs | Set 2

    C ++默認參數(shù)| 查找輸出程序| 套裝2

  • C++ Class and Objects | Find output programs | Set 1

    C ++類和對象| 查找輸出程序| 套裝1

  • C++ Class and Objects | Find output programs | Set 2

    C ++類和對象| 查找輸出程序| 套裝2

  • C++ Class and Objects | Find output programs | Set 3

    C ++類和對象| 查找輸出程序| 套裝3

  • C++ Class and Objects | Find output programs | Set 4

    C ++類和對象| 查找輸出程序| 套裝4

  • C++ Class and Objects | Find output programs | Set 5

    C ++類和對象| 查找輸出程序| 套裝5

翻譯自: https://www.includehelp.com/cpp-tutorial/arrays-find-output-programs-set-5.aspx

c ++查找字符串

總結(jié)

以上是生活随笔為你收集整理的c ++查找字符串_C ++数组| 查找输出程序| 套装5的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。