954,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Array problems

Hi all..
i am doing myC++ assignment and i got problem in adding, deleting, and modify records.
It should be some problem, but i dunno what's wrong. can somebody give me some tips for doing this ?
THanks

Domo
Newbie Poster
2 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

What? You need to show some code so we can see what your problem is.

prog-bman
Junior Poster
109 posts since Nov 2004
Reputation Points: 14
Solved Threads: 4
 

elements of an array are not called "records". A record is something you play on a phonograph machine, history of your activities in prison, or a complete collection of data in a file.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

I'm not 100% adept with c/c++ - but...

as you've posted no code - i'll hazard a guess:

- You need to create the type


struct my_record
{
/* your data types


*/
};

- Then make a variable of it


struct my_rec my_var[100]

/* obviously determine how many you want in an array */

Then again i'm not 100% sure what the problem is... so post some code or an insight to the problem!

dwhyte1985
Newbie Poster
2 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

Hey guys.. i need ur help again
this is my code:

cout<<"Please insert a new video ID:"<<endl;
    cin>>videoNum;
    cout<<"Please insert a new video Name:"<<endl;
    cin>>videoName;
    cout<<"The new Video ID:"<<videoNum<<endl;
    cout<<"The new Video Name:"<<videoName<<endl;


<< moderator edit: added [code][/code] tags >>

when i input the videoName such as "white chicks"...
the output will be White only.
can somebody tell me why?

the data type for videoName is char videoName[30];

Thanks for ur help guys..
cheers!

Domo
Newbie Poster
2 posts since Aug 2005
Reputation Points: 10
Solved Threads: 0
 

cin uses whitespace (a space, tab, etc.) to know when to stop reading. use cin.getline() .

winbatch
Posting Pro in Training
466 posts since Feb 2005
Reputation Points: 68
Solved Threads: 18
 

or lok up the modifiers std::skipws and std::noskipws

Stoned_coder
Junior Poster
164 posts since Jul 2005
Reputation Points: 19
Solved Threads: 5
 

so,you can use this == >gets();

gets(videoName);



:idea:

l3.azarmehr
Newbie Poster
7 posts since Aug 2005
Reputation Points: 13
Solved Threads: 1
 

The function gets is not safe and should be avoided . As in, NEVER use it.

Dave Sinkula
long time no c
Team Colleague
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
 

yeah, this function is not safe.
;) thanks ==> "Dave Sinkula".

l3.azarmehr
Newbie Poster
7 posts since Aug 2005
Reputation Points: 13
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You