intro34.cpp

来自「TC-ucos-philos-详细注释.rar 用TC编译ucos并在图像」· C++ 代码 · 共 22 行

CPP
22
字号
//INTRO34.CPP-Example from Chapter 3, "An Introduction to C++"

#include <iostream.h>

int main()
{
	char name[40];
	char *str_ptr = name;
	int pos, num_chars;

	cout << "Enter a string for the character array: ";
	cin.get(name,40,'\n');
	cout << "How many characters do you want to extract? ";
	cin >> num_chars;

	for (pos = 0; pos < num_chars; pos++)
		cout << *str_ptr++;
	cout << '\n';

   return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?