⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 structures.cpp

📁 examples C,c++ codes programs
💻 CPP
字号:
// example about structures
#include <iostream.h>
#include <string.h>
#include <stdlib.h>
 
struct movies_t {
  char title [50];
  int year;
} mine, yours;
 
void printmovie (movies_t movie);
 
int main ()
{
  char buffer [50];
 
  strcpy (mine.title, "2001 A Space Odyssey");
  mine.year = 1968;
 
  cout << "Enter title: ";
  cin.getline (yours.title,50);
  cout << "Enter year: ";
  cin.getline (buffer,50);
  yours.year = atoi (buffer);
 
  cout << "My favourite movie is:\n ";
  printmovie (mine);
  cout << "And yours:\n ";
  printmovie (yours);
  return 0;
}
 
void printmovie (movies_t movie)
{
  cout << movie.title;
  cout << " (" << movie.year << ")\n";
}
 

⌨️ 快捷键说明

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