49,760 Topics

Member Avatar for
Member Avatar for daino

The below code simply reads the string **"This is a test"** from a text file and displayes it on the console. I've deliberately placed an endline at the end of each time the string is loaded to show that the string is all that is passed to '**mystring**' from '**myfile**'. …

Member Avatar for daino
0
215
Member Avatar for you207

Hi ! I have arrray A[n][n] and i can input numbers in the interval -100 and 100 . I need to copy array A to array C[n*n] , and copy the number who are in a user iputed interval [k;l] and sort array C. I need help . I out …

Member Avatar for vmanes
0
414
Member Avatar for VUEKID

ok, NEED HELP HERE TO GET ALL THE CHARACTERS IN THE TEXT FILE AS A FULL LENGTH AND DO SOMETHING WITH IT... Line 31 #include "stdafx.h" #include<stdio.h> #include<stdlib.h> #include<string.h> #include <iostream> #include <iomanip> #include <string> #include <sstream> #include <fstream> #ifndef _DEPRECATION_DISABLE /* One time only */ #define _DEPRECATION_DISABLE /* Disable …

Member Avatar for tinstaafl
0
193
Member Avatar for beastie805

I am having a problem with readin input data, my program is reading the last name in my .txt document twice and inserting it into each one of my functions an extra time. here is the out put Enter the name of the .txt file that you want to open …

Member Avatar for beastie805
0
190
Member Avatar for uswer

1. Write a C++ program that simulates the throw of a dice. The program allows the user to enter the number of throws he/she would like to do. The program then, will calculate the statistics of the number of faces appears in these throws. The program should satisfies the following: …

Member Avatar for Jamblaster
0
161
Member Avatar for jalal hashmi

#include <iostream> #include <conio.h> using namespace std; void showSeats (void); char firstClass[2][6]; char busClass [5][6]; char ecoClass [6][6]; int main() { char seatType; int seatNum; char seatChar; // make all the seats available for(int i =0; i<6; i++) { for(int j =0;j<6;j++) { if(i<2) firstClass[i][j]='*'; if(i<5) busClass[i][j] = '*'; ecoClass …

Member Avatar for Ancient Dragon
0
203
Member Avatar for frlg

# include <iostream> # include <fstream> # include <string> using namespace std; struct primera # include <iostream> # include <fstream> # include <string> using namespace std; struct primera { int ID; char nombre [50]; char fecha_de_alta [10]; char fecha_de_caducidad [10]; int cantidad_en_existencia; char marca_presentacion [50]; float costo_para_mi; float bonificacion; float …

Member Avatar for tinstaafl
0
120
Member Avatar for cambalinho

the csbi.wAttributes are combinations of '|' operators,... DWORD textcolor = csbi.wAttributes & 0xff0f; DWORD backcolor = (csbi.wAttributes & 0xfff0) >> 4; i understand the 0xff0f is a hexadecimal value(i don't know in decimal), but why these number and not other? can anyone explain to me these 2 calculations? (they are …

Member Avatar for cambalinho
0
166
Member Avatar for cambalinho

i have these code for clear the screen: //clear the Console void Clear(int BackColor=0) { // home for the cursor COORD coordScreen = {0, 0}; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; // Get the number of character cells in the current buffer if(!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi)) return; dwConSize = csbi.dwSize.X * csbi.dwSize.Y; …

Member Avatar for cambalinho
0
217
Member Avatar for cambalinho

the prototype function is: BOOL WINAPI WriteConsoleOutputAttribute( _In_ HANDLE hConsoleOutput, _In_ const WORD *lpAttribute, _In_ DWORD nLength, _In_ COORD dwWriteCoord, _Out_ LPDWORD lpNumberOfAttrsWritten ); i'm trying use it for the 1st time... what means: "lpNumberOfAttrsWritten [out] A pointer to a variable that receives the number of attributes actually written to …

Member Avatar for cambalinho
0
2K
Member Avatar for PulsarScript

Thats the code i have so far: int _tmain(int argc, _TCHAR* argv[]) { for ( int i = 1; i <= 9; i++) { for ( int j = 1; j <= 15; j++) { cout << "*"; } cout << endl; } return 0; } but can't figure out …

Member Avatar for darkfire3133
0
190
Member Avatar for kbear23

I'm trying to convert int x and y arrays to string using a sample code found online. string Square::int2string (int x[]) { string returnstring = ""; for (int i=0; i < 4; i++) { returnstring += itoa(x[i]); return returnstring; } } but hit with the following error. Square.cpp:30:8: error: prototype …

Member Avatar for kiran.ghodke.395
0
4K
Member Avatar for skyyadav

#include <string> #include <iostream> #ifndef NAME_H #define NAME_H class Name { private: std::string first_,last_ ; public: explicit Name(const std::string & first = "john", const std::string & last = "doc"):first_(first),last_(last) { if(!isvalidlast(last_) || isvalidfirst(first_)) throw "Name :: Name(const string &,const string &):invalid Name"; } static bool isvalidlast(const std::string & last){} static …

Member Avatar for skyyadav
0
181
Member Avatar for Ng

How To Determine The Best Score? I am doing a lab regarding 'guess number game' Actually,the answer should be the random number,but I set the exact number to 88,because it is easy for me to test other requirement. I need to printf("Best Score so far [X]") How to make comparison …

Member Avatar for Jamblaster
0
225
Member Avatar for cambalinho

i know use SetConsoleTextAttribute(): SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ForgC|(BackC<<4) ); (too be honest: i don't have sure if i can avoid the '<<4') i need ask these: can i add it more data and then use it? like: Blink=128 SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), ForgC|(BackC<<4) | Blink); and then test if these value is there?

Member Avatar for cambalinho
0
245
Member Avatar for theashman88

I'm taking a database class, to be more specific MySQL. I want to know if I will use this if I enter the programing field as a C#, C++, or Java programmer. If so what will I need to know

Member Avatar for RomelynCastillo
0
331
Member Avatar for kbear23

Hello, Need some help with Pointers, please. I have base class ShapeTwoD and 3 derived classes: Cross, Rectangle and Square. Each have different x and y values input by user. Eg, Cross has 12 sets of x,y coordinates, Rectangle and Square have 4 sets each. Can I know how to …

Member Avatar for kbear23
0
2K
Member Avatar for mehdix

Hi All, I was assigned to code a project which to some extend simulates timetable of an airport. This has to be implemented using linkedLists. The poject should consist of Node class and SLL (singly linked list) class. The logic of the project is like this: There should be a …

Member Avatar for deceptikon
0
274
Member Avatar for WaelTheNoble

Hi guys, I want to construct 2D shapes in C++ program. I want to get as output an array of 2D points representing the 2D shape, while the input is the 2D shape parameters. For example, I want to pass to the function the center and radius for a circle, …

0
119
Member Avatar for beastie805

I need help reading a bool function from my HW assignment, I am not asking you to do complete my assignment for me. All I need help with is reading my bool function in main. Thank you for looking #include<iostream> #include<fstream> #include<string> using namespace std; struct StudentType {string studentName; int …

Member Avatar for beastie805
0
685
Member Avatar for tohtori.o

I'm trying to do the following: 1. get username typed into the userField 2. make a SEARCH mysql_query with the username as a variable I'm having a hard time getting past phase 2 since mysql_query takes a const char* as the query string, and I can only get username as …

Member Avatar for Ancient Dragon
0
285
Member Avatar for VBOI

**Why is it that when i use ctime to capture the time I am getting this error: time_t now = time(0);// convert now to string form char* dt = ctime(&now); cout << "The local date and time is: " << dt << endl; error C4996: 'ctime': This function or variable …

Member Avatar for deceptikon
0
2K
Member Avatar for Jun Bryan

I just need a simple program fragment that saves sentences/phrases and can load as exactly as the input. Do not rely on this code as I had made several failed attempted solutions. This is only what I remember: #include<fstream.h> #include<iostream.h> #include<string.h> #include<conio.h> main() {int x=0;char strings[5][50]; ofstream save("data.txt",ios::out) while(x<5) {gets(strings[x]); …

Member Avatar for Ancient Dragon
-1
138
Member Avatar for VUEKID
Member Avatar for VUEKID

Okay, so I know how to reverse the whole string of a vector, [code]for_each(newLines.begin(), newLines.end(), [](std::string& s){ reverse(s.begin(), s.end()); }); copy(newLines.begin(), newLines.end(), std::ostream_iterator<std::string> (std::cout, "\n")); [/code] But is there a way to only reverse the first 10 or so characters of a vector string? i.e. sdjkfskjd sfdsdf sdjflkjsdjklfsdlkjflksdjfkls jklda sdfioss …

Member Avatar for tinstaafl
0
178
Member Avatar for ik1610

Hello! I am trying to implement a persistent data structure using a vector of linked lists, but each time I am adding the modified list to the vector, all the old entries seem to be updated... Could you please help me? Definition of the vector of linked lists (the list …

Member Avatar for sepp2k
0
301
Member Avatar for pro_student

please can you help me to solve this problem :>>> no develop a bookstore information system. The bookstore manages a collection of books it is selling, book orders, and customers who purchased from the store. A book store also has a counter that accepts cash from book sales. Each book …

Member Avatar for pro_student
0
281
Member Avatar for Ankur_2
Member Avatar for Learner010

i have a question that is this possible to create database application through c++ ? don't be confused in database application and file oriented application . if yes, then how can we create database application ?

Member Avatar for sidy
0
208
Member Avatar for coiseng

Hi all, I need some help regarding dynamic vector. Shape2DLink.cpp void Shape2DLink::InputSensor() { string shape,type; cout<<endl<<"\n"<<"[ Input sensor data ]"<<endl; cout << "Please enter name of shape: " << endl; cin >> shape; shape2D.setName(shape); cout << "Please enter special type : " << endl; cin >> type; shape2D.setWarpSpace(type); if(shape == …

Member Avatar for Moschops
0
474

The End.