Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
char array in class
#include <cstdio> using namespace std; class Test{ public: char name[10]; Test(char* n){ int i=0; while(*n != 0) name[i++] = *(n++); } }; int main(){ char in[10]; Test* data[3]; for(int i=0;i<3;++i){ scanf("%s",&in);//input: A B C data[i] = new Test(&in[0]); } for(int i=0;i<3;++i){ printf("%s ",data[i]->name);//output: A B C } return 0; }
run
|
edit
|
history
|
help
0
C++ Inheritance Example
PreDir2
Destroy It!
expm1
Problem: binary
Hacher Cup
Network UVa
collection Hetero
Pollard Rho Brent Integer Factorization - 11476 - Factorizing Larget Integers
Extended Euclidean Algorithm