Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionError while using static int for incremental record. Pin
Tarun Jha10-Mar-18 0:02
Tarun Jha10-Mar-18 0:02 
AnswerRe: Error while using static int for incremental record. Pin
Richard MacCutchan10-Mar-18 1:09
mveRichard MacCutchan10-Mar-18 1:09 
GeneralRe: Error while using static int for incremental record. Pin
Tarun Jha10-Mar-18 1:44
Tarun Jha10-Mar-18 1:44 
GeneralRe: Error while using static int for incremental record. Pin
Richard MacCutchan10-Mar-18 2:04
mveRichard MacCutchan10-Mar-18 2:04 
PraiseRe: Error while using static int for incremental record. Pin
CPallini10-Mar-18 11:27
mveCPallini10-Mar-18 11:27 
Questiontwo errors Pin
Member 137186819-Mar-18 21:24
Member 137186819-Mar-18 21:24 
AnswerRe: two errors Pin
Victor Nijegorodov9-Mar-18 21:44
Victor Nijegorodov9-Mar-18 21:44 
Questionhow to get a string as input ? Pin
Tarun Jha9-Mar-18 16:45
Tarun Jha9-Mar-18 16:45 
Here's what i have tried.

#include <iostream>
#include <cstring>
#define MAX 100
using namespace std;

int m=0;
class Names{
        char name[5][30];
        //static int m;
    public:
        //Names(){m++;}
        void getdata(){
            //int temp = m;
            //string s;
            cout<<"Entre name :\t";
            cin.ignore(1000, '\n');
            cin>>name[m];
            //getline(cin, name[m]);
            //strcpy(name[m],s);
            m++;
        }
        void display(void){
            for(int i=0; i<m; i++){
                cout<<name[i]<<endl;
            }
        }
};

int main(){
    Names x;
    for(int i=0; i<5; i++){
        x.getdata();
    }
    x.display();

    return 0;
}


i tried getline(), but it was giving error. How do i take a string as a input ?

modified 10-Mar-18 0:37am.

AnswerRe: how to get a string as input ? Pin
Sampath5799-Mar-18 20:15
Sampath5799-Mar-18 20:15 
QuestionRe: how to get a string as input ? Pin
David Crow10-Mar-18 11:07
David Crow10-Mar-18 11:07 
AnswerRe: how to get a string as input ? Pin
Tarun Jha15-Mar-18 7:50
Tarun Jha15-Mar-18 7:50 
QuestionHow can I minimize memory usage in my table-based statemachine with several hundred states? Pin
arnold_w9-Mar-18 9:02
arnold_w9-Mar-18 9:02 
GeneralRe: How can I minimize memory usage in my table-based statemachine with several hundred states? Pin
harold aptroot9-Mar-18 9:54
harold aptroot9-Mar-18 9:54 
GeneralRe: How can I minimize memory usage in my table-based statemachine with several hundred states? Pin
arnold_w9-Mar-18 10:00
arnold_w9-Mar-18 10:00 
GeneralRe: How can I minimize memory usage in my table-based statemachine with several hundred states? Pin
harold aptroot9-Mar-18 10:14
harold aptroot9-Mar-18 10:14 
AnswerRe: How can I minimize memory usage in my table-based statemachine with several hundred states? Pin
leon de boer9-Mar-18 15:16
leon de boer9-Mar-18 15:16 
QuestionHow to get object of a view which is created using AddView(). Pin
Sampath5799-Mar-18 0:38
Sampath5799-Mar-18 0:38 
AnswerRe: How to get object of a view which is created using AddView(). Pin
Victor Nijegorodov9-Mar-18 1:45
Victor Nijegorodov9-Mar-18 1:45 
GeneralRe: How to get object of a view which is created using AddView(). Pin
Sampath57910-Mar-18 23:20
Sampath57910-Mar-18 23:20 
GeneralRe: How to get object of a view which is created using AddView(). Pin
Victor Nijegorodov11-Mar-18 2:05
Victor Nijegorodov11-Mar-18 2:05 
AnswerRe: How to get object of a view which is created using AddView(). Pin
Richard MacCutchan9-Mar-18 5:18
mveRichard MacCutchan9-Mar-18 5:18 
GeneralRe: How to get object of a view which is created using AddView(). Pin
Sampath57911-Mar-18 6:04
Sampath57911-Mar-18 6:04 
GeneralRe: How to get object of a view which is created using AddView(). Pin
Victor Nijegorodov11-Mar-18 7:12
Victor Nijegorodov11-Mar-18 7:12 
GeneralRe: How to get object of a view which is created using AddView(). Pin
Richard MacCutchan11-Mar-18 22:32
mveRichard MacCutchan11-Mar-18 22:32 
QuestionHow to release IDispatch memory. Pin
Sampath5797-Mar-18 2:45
Sampath5797-Mar-18 2:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.