User Profile
Collapse
-
I am not allowed to use either two dimensional array or structure in this question. Is there any logical solution?... -
how to change the array in for loop
I ve five different arrary of test scores
person 1 -> test_score1[4]
person 2 -> test_score2[4]
how to change to array of test_score1 to test_score2 in for loop for person1 to person2 to insert the values in test_score array.
...Code:for(int i=0;i<5;i++) { cout<<"Give the name of the student "<<i+1<<": "; cin>>names[i]; cout<<"Give -
IF you dont use the function floor(...) in your code then I made simple solution may it will help you. Thanks
#include<iostre am>
using namespace std;
int determinePage(i nt);
int main()
{
int page_number;
static int virtual_addr[10]=
{8196,34893,385 83,22883,61843, 43532,333,8448, 2334,9492};
cout << "Page Number is: " <<endl;...Leave a comment:
-
the function named floor(.......) used is not identified by c++ complier or is it user defined function?Leave a comment:
-
If you are talking about the forward slash for the path of the file as long as I know and it works with out any problem.
c:/tc/email.txt
file path is working
But once If i give the file path like
c=/tc/m.txt //in this file path there is something wrong in place of colon it was '=' sign.
this is going to be incorrect and while loop certainly give error message to the user with...Leave a comment:
-
File handling String related question
I've declared the string realPath as
string realPath;
realPath = "c:/tc/matrix.txt";
when i use realPath for the path of file to open like
fstream infile;
infile.open(realPath, ios::in); //This line generate error like
///////////////////////////////////////
error msg:
1>.\read_matrix _table.cpp(31) : error C2664: 'void std::basic_fstr eam<_Elem,_Trai ts>::open(const... -
I did use cin.ignore() with in while body but same problem no change...Leave a comment:
-
Problem in file handling!
Once the program goes through the while loop which is checking the file existence like in this code
...Code:#include<iostream> #include<fstream> using name space std; int main() { read_emails(); return 0; } void read_emails() { fstream infile; char path[100]; cout<<"Format of the path is like this: c:/tc/test.txt"; cout<<"Give -
Thank for reply but actuall I am talking about the array length not the size in bit or bytes.Leave a comment:
-
-
But It has already been said in the question that Your program should handle up to 20 integer numbers. Declare the array as a global variable..
In the real code I am not supposed to make the array of size 21. Thank you!Leave a comment:
-
Its ok counter part I will handle it. but isn't there any function in fstream
library that will help me to loop through the text file till second last of the number list.
The actual question is like this
Q. Write a program that will manipulate an array. Your program should handle up to 20 integer numbers. Declare the array as a global variable. (This is the only time you should use a global variable.)
...Leave a comment:
-
I knew that It does work like nums.length work as a value for the size of the array in java but I need the code for the c++. Thank You though.Leave a comment:
-
wher I can use the code you send me
your code is below
ifstream myfile;
myfile.seekg(SE EK_END - 2*sizeof(int));
in my code bellow
#include<iostre am>
#include<fstrea m>
using namespace std;
int main()
{
const int size = 20;
int arr[20];
int count=0;
fstream infile;
infile.open("c:/C++/array1.txt");...Leave a comment:
-
If I dont know how many number are there in the file. It might more than 12 might be 14 or 16 or 17 whatever (within 20). Here I've to pick up the numbers up to second last from a file.
like I already create global array as
#include<iostre am>
#include<fstrea m>
using namespace std;
int main()
{
const int size = 20;
int arr[20];
int count=0;
fstream infile;...Leave a comment:
-
Reading in text file in c++
I've 13 int number as a list in txt file.
34
55
99
120
57
45
49
30
32
21
56
22
0
The last value is a 0 and is NOT one of the values to be used in any calculation . I am supposed to create only one array as global variable.
So what would be the logic behind(with code) to read all the numbers from the file except the last one (i.e,... -
Declaring an array with size in C++
The java code below is well functioning code where I did was;
I used nums.length as the size for the declaring the new arrary within the function body.
If I am trying to do the same thing...Code:public int[] reverse3(int[] nums) { int[] temp = new int[[B]nums.length[/B]]; for(int i=0;i<nums.length;i++) { temp[i] = nums[nums.length-(i+1)]; } return temp; } -
what is the best solution to create an array of variable size.
If any body could give me the solution of how to create and array of variable size in java or in c++ (Note: except the linked list concept).
Please!
would be very appriciable Thank you!
No activity results to display
Show More
Leave a comment: