is there a way to make array as a float?

I'm making a credit card billing statement so i kinda need to use an array to save multiple variables. so is there a way to use array on float because decimal numbers is very much needed in my program...thnx for the reply in advance
Of course. Why don't you just try it?
Of course you can use array with floats (or better doubles) but I guess since you want to make a program working with credit card (even if it's a toy program only) you should first consider what kind you want your array to accomplish.

Integer has the benecit to be exact and to make this ideal for comparison.

Float
s have more flexibility in representing numbers but lack this exactness meaning you can store amount on them but it's not a good idea to store card id for example.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include<iostream>
#include<cstdlib>
using namespace std;
main()
{
    double num[100],result=0, x;//this part is not working
    double member=0;
    char name[100], address[300];
    int date=0, pdate[100];
            
            system("cls");
            cout<<"\t\t\t+++++++++++++++++++++++++++++++\n";
            cout<<"\t\t\t| Welcome to American Express |\n";
            cout<<"\t\t\t+++++++++++++++++++++++++++++++\n";
            cout<<"\n\nEnter Name: ";
            cin>>name;
            do
            {
                cout<<"\nEnter Membership No.: ";
                cin>>member;
                if(member<=0)
                {
                    cout<<"Invalid Input! Try Again!\n";
                    cin.clear();
                    cin.ignore();
                }
            }while(member<=0);
            do
            {   
                cout<<"\nEnter Date: ";
                cin>>date;
                if(date<112012||date>=112018)
                {
                    cout<<"Invalid Input! Try Again!\n";
                    cin.clear();
                    cin.ignore();
                }
            }while(date<112012||date>=112018);
               do
                {
                    cout<<"Enter Amount "<<x<<":";
                    cin>>num[x];
                    cout<<"Enter Date "<<x<<":";
                    if(!cin)
                    {
                        cout<<"Invalid Input! Please Try Again!\n";
                        cin.clear();
                        cin.ignore();
                        x=0;
                    }
                }while(!cin);
    system("pause");
    
}

this code wont allow me to run my program...
It's not the line you're suggesting in comments; it's the line above.

main needs to return an integer. You haven't specified a return type.

Furthermore, line 42 is going to give you some trouble. The variable x really ought to be an integer, since it's being used as an array index.
ok thnx...but I still don't know how to fix this...
Make x an integer and have your main function return an integer.

Functionally, I'm not sure if that will fix your program in the sense that it'll do what you want it to; I haven't looked that far ahead yet and that'll be up to you.

It will, however, allow your code to compile.
hey how bout that...your right i didn't even notice that.. thanks a lot you've been a big help.
Topic archived. No new replies allowed.