| | |
int value in an array to character value
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2008
Posts: 7
Reputation:
Solved Threads: 0
I need help to change certain values in an Array that I have to a character array.
Here's the code
Here's the code
C++ Syntax (Toggle Plain Text)
#include <iostream> using namespace std; int main() { char X; int nROWS = 4; int nCOLUMNS = 4; int anArray[4][4] = {{0,1,2,3}, {10,11,12,13}, {20,21,22,23}, {30,31,32,33}}; string headings[4] = {"LA", "CLT", "SVO", "FR"}; cout << "\t"<<headings[0]<<"\t"<<headings[1]<<"\t"<<headings[2]<<"\t"<<headings[3]<<endl; if (anArray[0][0] == 0) anArray[0][0] == X; cout << headings[0] << "\t" << anArray[0][0] << "\t" << anArray[0][1]<< "\t" << anArray[0][2] << "\t" << anArray[0][3]<<endl; if (anArray[1][0] == 10) cout <<"X"; if (anArray[1][1] == 11) cout << "X"; cout << "\n" <<headings[1] << "\t" << anArray[1][0] << "\t" << anArray[1][1]<< "\t" << anArray[1][2] << "\t" << anArray[1][3]<<endl; if (anArray[2][2] == 22) cout << "X"; cout << "\n" <<headings[2] << "\t" << anArray[2][0] << "\t" << anArray[2][1]<< "\t" << anArray[2][2] << "\t" << anArray[2][3]<<endl; if (anArray[3][3] == 33) cout << "X"; cout << "\n" << headings[3] << "\t" << anArray[3][0] << "\t" << anArray[3][1]<< "\t" << anArray[3][2] << "\t" << anArray[3][3]<<endl; system("pause"); return 0; }
![]() |
Similar Threads
- convert integer to array of character??? (C++)
- Problems from string to int array (C)
- How to Sort a MultiDimensional Array (C)
- fstream to char and int array (C++)
- Convert first character from lowercase to uppercase? (C)
- Sorting character arrays! (C++)
- problem creating a for loop for an array (C++)
- Need Help counting Array Length (C++)
Other Threads in the C++ Forum
- Previous Thread: sum control path
- Next Thread: please help me in my project (urgent )
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll download dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets





