Please solve my problem

K

Kausar.Nazir

Pronlem# 1: How can I Create a notepad file named number.txt which
consists of int type numbers separated with new lines on your hard
disk, a program which read the numbers form this file and show them to
screen, also display the total numbers in files and largest and
smallest numbers to the screen. Please guide me I will be very thank
full to you.

problem # 2: Write a simple structure named Students. This structure
consists of three variables Name, GPA and TotalMarks. Now write three
variables of data type Students. Get value from user for these three
students and show them on screen.
 
A

Alf P. Steinbach

* (e-mail address removed):
Pronlem# 1: How can I Create a notepad file named number.txt which
consists of int type numbers separated with new lines on your hard
disk,

That I won't tell you. Lay off my hard-disk.

a program which read the numbers form this file
Ditto.


and show them to
screen, also display the total numbers in files and largest and
smallest numbers to the screen. Please guide me I will be very thank
full to you.

This sounds like homework.

Read the FAQ's advice about posting homework questions.


problem # 2: Write a simple structure named Students. This structure
consists of three variables Name, GPA and TotalMarks. Now write three
variables of data type Students. Get value from user for these three
students and show them on screen.

This sounds like homework.

Read the FAQ's advice about posting homework questions.
 
S

Salt_Peter

Pronlem# 1: How can I Create a notepad file named number.txt which
consists of int type numbers separated with new lines on your hard
disk, a program which read the numbers form this file and show them to
screen, also display the total numbers in files and largest and
smallest numbers to the screen. Please guide me I will be very thank
full to you.

There is no such thing as a notepad file, you mean a plain text file.
You can open Notepad and just create the file using the keyboard.
Reading from that file should be a simple task using a std::fstream
(std file stream).
I'ld suggest a std::vector said:
problem # 2: Write a simple structure named Students. This structure
consists of three variables Name, GPA and TotalMarks. Now write three
variables of data type Students. Get value from user for these three
students and show them on screen.

That question gets asked a lot here (its Student, not Students). The
funny thing is most that do ask about it at least show an attempt at
creating the type Student.
 
G

gast128

There is no such thing as a notepad file, you mean a plain text file.
You can open Notepad and just create the file using the keyboard.
Reading from that file should be a simple task using a std::fstream
(std file stream).
I'ld suggest a std::vector< int > to store the integers.




That question gets asked a lot here (its Student, not Students). The
funny thing is most that do ask about it at least show an attempt at
creating the type Student.

You are very hard on this poster. Maybe he is just a student which
spents to much time in the pub (I get a deja vu feeling).

You should get an A if you try Boost.Serialization (www.boost.org).
Serializing integers / structs to (and from) file is then only a
matter of writing the correct archive operator.

If you don't have that ambition using ostream_iterators and
istream_iterators on std::fstream will do the job as well.
 
O

osmium

Pronlem# 1: How can I Create a notepad file named number.txt which
consists of int type numbers separated with new lines on your hard
disk, a program which read the numbers form this file and show them to
screen, also display the total numbers in files and largest and
smallest numbers to the screen. Please guide me I will be very thank
full to you.

There are two parts to this. Create the file and then process the file.
You can do the first part with the Notepad program on your computer.

Pseudocode for part 2.
-----
open the file
smallest so far = a very big number
biggest so far= a very small number
ct = 0
repeat
read a datum
update the variables
until done
print the results
close the file
-----
problem # 2: Write a simple structure named Students. This structure
consists of three variables Name, GPA and TotalMarks. Now write three
variables of data type Students. Get value from user for these three
students and show them on screen.

I don't see how anyone could possibly help on this without giving the
answer, which is no help at all. I think the question has a significant
flaw, it should be Student, not Students.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

please solve my problem 2
Solve this question 10
Processing in Python help 0
please help me 0
a problem to solve 27
how to use c++ to efficiently solve this problem? 0
Tasks 1
Help me to solve this C++ problem 20

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top