How to use int vector?

closed account (16pXSL3A)
Hi dudes!
I want know how to use int vector! I know to use char vector!
---
Char vector e.g. program
I use Code Blocks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<windows.h>
using namespace std;
int main ()
{
 char a[20],b[20]="apple";
    cout<<"Guess my favorite fruit:";
    gets(a);
    while(strcmp(a,b)!=0)
    {
        cout<<"Try again:";
        gets(a);
    }
    cout<<"You guess! My favorite fruit is ";
    system("COLOR A");
    cout<<"apple!";
    return 0;
}

---
Guess my favorite fruit:orange
Try again:apple
You guess! My favorite fruit is apple!

---
How can i do it also with int vector?
And how's the difference from char[] and int[] ?
You can also contact me to help me with more :D [https://www.facebook.com/Bossul13333 ]
Last edited on
char[] and int[] are arrays

http://www.cplusplus.com/doc/tutorial/arrays/

Vectors are part of <vector> and look like vector<int> myVector

vectors and arrays are very similar. vectors are basically arrays with some built in functionality. See more about vectors below

http://www.cplusplus.com/reference/vector/vector/vector/

http://www.cplusplus.com/reference/vector/vector/
closed account (16pXSL3A)
http://www.cplusplus.com/user/RadWayne/ @RadWayne thanks! :D send to me a friend resqure via facebook and... Can you send to me this program "guess my favorite...." made by int vectors? please! :)
Last edited on
Topic archived. No new replies allowed.