Answered by:
C++ simple question!

Question
-
Okay so i am trying to make a program to help me learn and see what I can do at this time!
I am trying to make a string that has 2 variables on it
ex:
1card1
2card1
1card2
2card2etc...
[x]card[y] kind of thingso like how would you go about doing this? or will i have to do the long way around this?
- Moved by litdev Saturday, October 24, 2015 3:45 PM
Saturday, October 24, 2015 7:01 AM
Answers
-
Hi, joemdoo:
There are some tips may help you:
- “[x]card[y]” includes some basic concepts. For example, string (if you want to store these strings and manipulate them by string manipulation), loop and etc.
- For the string manipulation, you could search key words like “Strings and String Manipulation in C++”, and you will find some examples or tutorials to learn.For the loop, of course, just search the key words like “loops in C++”Through these examples or tutorials, you could learn to write your own program. During the process of writing your program, if you have some problems, you could post the problem in the forum, all related questions are welcomed in our forum.
- Of course, systematic study will help you a lot.
I write a sample below, and hope it’s helpful to you.
#include "stdafx.h" #include<iostream> #include<string> using namespace std; int main(){ int numline=5;//numlne defines how many pairs to be showed int firstnum[] = { 1,2 }; for (int i = 1; i<numline; i++) { cout << firstnum[0] << "card" << i << endl; cout << firstnum[1] << "card" << i << endl; cout << '\n'; } return 0;}
Best regards,
chchlll
Monday, October 26, 2015 8:08 AM
All replies
-
Please ask this in a C++ forum. This one is about the Small Basic language.
Jan [ WhTurner ] The Netherlands
Saturday, October 24, 2015 2:22 PM -
Okay so i am trying to make a program to help me learn and see what I can do at this time!
I am trying to make a string that has 2 variables on it
ex:
1card1
2card1
1card2
2card2etc...
[x]card[y] kind of thingso like how would you go about doing this? or will i have to do the long way around this?
Saturday, October 24, 2015 4:26 PM -
Hi, joemdoo:
There are some tips may help you:
- “[x]card[y]” includes some basic concepts. For example, string (if you want to store these strings and manipulate them by string manipulation), loop and etc.
- For the string manipulation, you could search key words like “Strings and String Manipulation in C++”, and you will find some examples or tutorials to learn.For the loop, of course, just search the key words like “loops in C++”Through these examples or tutorials, you could learn to write your own program. During the process of writing your program, if you have some problems, you could post the problem in the forum, all related questions are welcomed in our forum.
- Of course, systematic study will help you a lot.
I write a sample below, and hope it’s helpful to you.
#include "stdafx.h" #include<iostream> #include<string> using namespace std; int main(){ int numline=5;//numlne defines how many pairs to be showed int firstnum[] = { 1,2 }; for (int i = 1; i<numline; i++) { cout << firstnum[0] << "card" << i << endl; cout << firstnum[1] << "card" << i << endl; cout << '\n'; } return 0;}
Best regards,
chchlll
Monday, October 26, 2015 8:08 AM